fix(接口自动化): 接口相关问题修复
This commit is contained in:
parent
ffd3ae48fa
commit
a4c6d24e14
|
@ -197,6 +197,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
|||
}
|
||||
|
||||
compatible(config);
|
||||
|
||||
HttpConfig httpConfig = null;
|
||||
try {
|
||||
if (config.isEffective(this.getProjectId())) {
|
||||
|
@ -204,6 +205,9 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
|||
if (httpConfig == null && !isURL(this.getUrl())) {
|
||||
MSException.throwException("未匹配到环境,请检查环境配置");
|
||||
}
|
||||
if(StringUtils.isEmpty(httpConfig.getProtocol())){
|
||||
MSException.throwException(this.getName() +"接口,对应的环境无协议,请完善环境信息");
|
||||
}
|
||||
if (StringUtils.isEmpty(this.useEnvironment)) {
|
||||
this.useEnvironment = config.getConfig().get(this.getProjectId()).getApiEnvironmentid();
|
||||
}
|
||||
|
@ -428,11 +432,11 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
|||
}
|
||||
|
||||
// 数据兼容处理
|
||||
if (config.getConfig() != null && config.getConfig().containsKey(getParentProjectId())) {
|
||||
if (config.getConfig() != null && StringUtils.isNotEmpty(this.getProjectId()) && config.getConfig().containsKey(this.getProjectId())) {
|
||||
// 1.8 之后 当前正常数据
|
||||
} else if (config.getConfig() != null && config.getConfig().containsKey(getParentProjectId())) {
|
||||
// 1.8 前后 混合数据
|
||||
this.setProjectId(getParentProjectId());
|
||||
} else if (config.getConfig() != null && StringUtils.isNotEmpty(this.getProjectId()) && config.getConfig().containsKey(this.getProjectId())) {
|
||||
// 1.8 之后 当前正常数据
|
||||
} else {
|
||||
// 1.8 之前 数据
|
||||
if (config.getConfig() != null) {
|
||||
|
|
|
@ -883,7 +883,6 @@ public class ApiAutomationService {
|
|||
request.setTriggerMode(ReportTriggerMode.MANUAL.name());
|
||||
}
|
||||
String reportId = request.getId();
|
||||
|
||||
Map<APIScenarioReportResult, HashTree> map = new LinkedHashMap<>();
|
||||
List<String> scenarioIds = new ArrayList<>();
|
||||
StringBuilder scenarioNames = new StringBuilder();
|
||||
|
|
|
@ -569,9 +569,11 @@ public class ApiDefinitionService {
|
|||
Map<String, String> map = request.getEnvironmentMap();
|
||||
if (map != null && map.size() > 0) {
|
||||
ApiTestEnvironmentWithBLOBs environment = environmentService.get(map.get(request.getProjectId()));
|
||||
EnvironmentConfig env = JSONObject.parseObject(environment.getConfig(), EnvironmentConfig.class);
|
||||
envConfig.put(request.getProjectId(), env);
|
||||
config.setConfig(envConfig);
|
||||
if (environment != null) {
|
||||
EnvironmentConfig env = JSONObject.parseObject(environment.getConfig(), EnvironmentConfig.class);
|
||||
envConfig.put(request.getProjectId(), env);
|
||||
config.setConfig(envConfig);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -326,8 +326,12 @@ public class ApiScenarioReportService {
|
|||
*/
|
||||
private void updateScenarioStatus(String reportId) {
|
||||
if (StringUtils.isNotEmpty(reportId)) {
|
||||
List<String> list = new ArrayList<>();
|
||||
list.add(reportId);
|
||||
List<String> list = new LinkedList<>();
|
||||
try {
|
||||
list = JSON.parseObject(reportId, List.class);
|
||||
} catch (Exception e) {
|
||||
list.add(reportId);
|
||||
}
|
||||
ApiScenarioReportExample scenarioReportExample = new ApiScenarioReportExample();
|
||||
scenarioReportExample.createCriteria().andIdIn(list);
|
||||
List<ApiScenarioReport> reportList = apiScenarioReportMapper.selectByExample(scenarioReportExample);
|
||||
|
@ -336,7 +340,7 @@ public class ApiScenarioReportService {
|
|||
if (CollectionUtils.isNotEmpty(reportList)) {
|
||||
reportList.forEach(report -> {
|
||||
report.setUpdateTime(System.currentTimeMillis());
|
||||
String status = "Success";
|
||||
String status = "Error";
|
||||
report.setStatus(status);
|
||||
scenarioReportMapper.updateByPrimaryKeySelective(report);
|
||||
// 把上一条调试的数据内容清空
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*/
|
||||
package io.metersphere.api.service.task;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.metersphere.api.dto.automation.RunScenarioRequest;
|
||||
import io.metersphere.api.jmeter.JMeterService;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
|
@ -28,7 +27,7 @@ public class ParallelScenarioExecTask<T> implements Callable<T> {
|
|||
@Override
|
||||
public T call() {
|
||||
try {
|
||||
jMeterService.runSerial(JSON.toJSONString(id), hashTree, request.getReportId(), request.getRunMode(), request.getConfig());
|
||||
jMeterService.runSerial(id, hashTree, request.getReportId(), request.getRunMode(), request.getConfig());
|
||||
return null;
|
||||
} catch (Exception ex) {
|
||||
LogUtil.error(ex.getMessage());
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*/
|
||||
package io.metersphere.api.service.task;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.metersphere.api.dto.automation.RunScenarioRequest;
|
||||
import io.metersphere.api.jmeter.JMeterService;
|
||||
import io.metersphere.base.domain.ApiScenarioReport;
|
||||
|
@ -34,7 +33,7 @@ public class SerialScenarioExecTask<T> implements Callable<T> {
|
|||
@Override
|
||||
public T call() {
|
||||
try {
|
||||
jMeterService.runSerial(JSON.toJSONString(id), hashTree, request.getReportId(), request.getRunMode(), request.getConfig());
|
||||
jMeterService.runSerial(id, hashTree, request.getReportId(), request.getRunMode(), request.getConfig());
|
||||
// 轮询查看报告状态,最多200次,防止死循环
|
||||
int index = 1;
|
||||
while (index < 200) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package io.metersphere.commons.constants;
|
||||
|
||||
public enum OperLogConstants {
|
||||
CREATE, DELETE, GC, RESTORE, DEBUG, UPDATE, BATCH_DEL, BATCH_UPDATE, BATCH_ADD, BATCH_RESTORE, BATCH_GC, IMPORT, EXPORT, ASSOCIATE_CASE, UN_ASSOCIATE_CASE, REVIEW, COPY, EXECUTE, SHARE, LOGIN, CREATE_PRE_TEST, OTHER
|
||||
CREATE, DELETE, GC, RESTORE, DEBUG, UPDATE, BATCH_DEL, BATCH_UPDATE, BATCH_ADD, BATCH_RESTORE, BATCH_GC, IMPORT, EXPORT, ASSOCIATE_CASE, ASSOCIATE_ISSUE, UN_ASSOCIATE_CASE, REVIEW, COPY, EXECUTE, SHARE, LOGIN, CREATE_PRE_TEST, OTHER
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import com.github.pagehelper.Page;
|
|||
import com.github.pagehelper.PageHelper;
|
||||
import io.metersphere.base.domain.Organization;
|
||||
import io.metersphere.commons.constants.OperLogConstants;
|
||||
import io.metersphere.commons.constants.RoleConstants;
|
||||
import io.metersphere.commons.utils.PageUtils;
|
||||
import io.metersphere.commons.utils.Pager;
|
||||
import io.metersphere.controller.request.OrganizationRequest;
|
||||
|
@ -13,8 +12,6 @@ import io.metersphere.dto.OrganizationResource;
|
|||
import io.metersphere.log.annotation.MsAuditLog;
|
||||
import io.metersphere.service.OrganizationService;
|
||||
import io.metersphere.service.UserService;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -67,7 +64,7 @@ public class OrganizationController {
|
|||
}
|
||||
|
||||
@PostMapping("/member/update")
|
||||
@MsAuditLog(module = "organization_member", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#memberDTO.id)", content = "#msClass.getLogDetails(#memberDTO.id)", msClass = OrganizationService.class)
|
||||
@MsAuditLog(module = "organization_member", type = OperLogConstants.UPDATE, content = "#msClass.getLogDetails(#memberDTO)", msClass = OrganizationService.class)
|
||||
public void updateOrgMember(@RequestBody OrganizationMemberDTO memberDTO) {
|
||||
organizationService.updateOrgMember(memberDTO);
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ public class UserController {
|
|||
}
|
||||
|
||||
@PostMapping("/special/update")
|
||||
@MsAuditLog(module = "system_user", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#user.id)", content = "#msClass.getLogDetails(#user.id)", msClass = UserService.class)
|
||||
@MsAuditLog(module = "system_user", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#user)", content = "#msClass.getLogDetails(#user)", msClass = UserService.class)
|
||||
public void updateUser(@RequestBody UserRequest user) {
|
||||
userService.updateUserRole(user);
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ public class UserController {
|
|||
* 添加组织成员
|
||||
*/
|
||||
@PostMapping("/org/member/add")
|
||||
@MsAuditLog(module = "organization_member", type = OperLogConstants.CREATE, title = "添加组织成员")
|
||||
@MsAuditLog(module = "organization_member", type = OperLogConstants.CREATE, title = "'添加组织成员-'+#request.userIds")
|
||||
public void addOrganizationMember(@RequestBody AddOrgMemberRequest request) {
|
||||
organizationService.checkOrgOwner(request.getOrganizationId());
|
||||
userService.addOrganizationMember(request);
|
||||
|
@ -331,6 +331,7 @@ public class UserController {
|
|||
}
|
||||
|
||||
@PostMapping("/import/{userId}")
|
||||
@MsAuditLog(module = "system_user", type = OperLogConstants.IMPORT)
|
||||
public ExcelResponse testCaseImport(MultipartFile file, @PathVariable String userId, HttpServletRequest request) {
|
||||
return userService.userImport(file, userId, request);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import com.github.pagehelper.Page;
|
|||
import com.github.pagehelper.PageHelper;
|
||||
import io.metersphere.base.domain.Workspace;
|
||||
import io.metersphere.commons.constants.OperLogConstants;
|
||||
import io.metersphere.commons.constants.RoleConstants;
|
||||
import io.metersphere.commons.utils.PageUtils;
|
||||
import io.metersphere.commons.utils.Pager;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
|
@ -15,8 +14,6 @@ import io.metersphere.log.annotation.MsAuditLog;
|
|||
import io.metersphere.service.OrganizationService;
|
||||
import io.metersphere.service.UserService;
|
||||
import io.metersphere.service.WorkspaceService;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -65,7 +62,7 @@ public class WorkspaceController {
|
|||
}
|
||||
|
||||
@GetMapping("special/delete/{workspaceId}")
|
||||
@MsAuditLog(module = "system_workspace", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#workspaceId)", msClass = WorkspaceService.class)
|
||||
@MsAuditLog(module = "system_workspace", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#workspaceId)", msClass = WorkspaceService.class)
|
||||
public void deleteWorkspaceByAdmin(@PathVariable String workspaceId) {
|
||||
userService.refreshSessionUser("workspace", workspaceId);
|
||||
workspaceService.deleteWorkspace(workspaceId);
|
||||
|
@ -104,7 +101,7 @@ public class WorkspaceController {
|
|||
}
|
||||
|
||||
@PostMapping("/member/update")
|
||||
@MsAuditLog(module = "workspace_member", type = OperLogConstants.UPDATE, title = "#memberDTO.name")
|
||||
@MsAuditLog(module = "workspace_member", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#memberDTO)", content = "#msClass.getLogDetails(#memberDTO)", msClass = WorkspaceService.class)
|
||||
public void updateOrgMember(@RequestBody WorkspaceMemberDTO memberDTO) {
|
||||
workspaceService.updateWorkspaceMember(memberDTO);
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ public class TestCaseReference {
|
|||
testCaseColumns.put("status", "用例状态");
|
||||
testCaseColumns.put("stepDescription", "步骤描述");
|
||||
testCaseColumns.put("expectedResult", "预期结果");
|
||||
testCaseColumns.put("demandName", "关联需求");
|
||||
testCaseColumns.put("comment", "评论");
|
||||
testCaseColumns.put("ms-dff-col", "tags");
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package io.metersphere.track.controller;
|
||||
|
||||
import io.metersphere.commons.constants.OperLogConstants;
|
||||
import io.metersphere.log.annotation.MsAuditLog;
|
||||
import io.metersphere.track.dto.TestCaseDTO;
|
||||
import io.metersphere.track.request.issues.IssuesRelevanceRequest;
|
||||
import io.metersphere.track.service.TestCaseIssueService;
|
||||
|
@ -24,6 +26,7 @@ public class TestCaseIssuesController {
|
|||
}
|
||||
|
||||
@PostMapping("/relate")
|
||||
@MsAuditLog(module = "track_test_case", type = OperLogConstants.ASSOCIATE_ISSUE, content = "#msClass.getLogDetails(#request)", msClass = TestCaseIssueService.class)
|
||||
public void relate(@RequestBody IssuesRelevanceRequest request) {
|
||||
testCaseIssueService.relate(request);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package io.metersphere.track.service;
|
||||
|
||||
import io.metersphere.base.domain.TestCaseIssues;
|
||||
import io.metersphere.base.domain.TestCaseIssuesExample;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.metersphere.base.domain.*;
|
||||
import io.metersphere.base.mapper.IssuesMapper;
|
||||
import io.metersphere.base.mapper.TestCaseIssuesMapper;
|
||||
import io.metersphere.log.vo.OperatingLogDetails;
|
||||
import io.metersphere.track.dto.TestCaseDTO;
|
||||
import io.metersphere.track.request.issues.IssuesRelevanceRequest;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -13,6 +14,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -56,9 +58,9 @@ public class TestCaseIssueService {
|
|||
}
|
||||
|
||||
public List<String> getTestCaseIdsByIssuesId(String issuesId) {
|
||||
return getTestCaseIssuesByIssuesId(issuesId).stream()
|
||||
.map(TestCaseIssues::getTestCaseId)
|
||||
.collect(Collectors.toList());
|
||||
return getTestCaseIssuesByIssuesId(issuesId).stream()
|
||||
.map(TestCaseIssues::getTestCaseId)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public void relate(IssuesRelevanceRequest request) {
|
||||
|
@ -86,4 +88,18 @@ public class TestCaseIssueService {
|
|||
testCaseIssues.setIssuesId(issueId);
|
||||
testCaseIssuesMapper.insert(testCaseIssues);
|
||||
}
|
||||
|
||||
|
||||
public String getLogDetails(IssuesRelevanceRequest request) {
|
||||
TestCaseWithBLOBs bloBs = testCaseService.getTestCase(request.getCaseId());
|
||||
if (bloBs != null) {
|
||||
IssuesExample example = new IssuesExample();
|
||||
example.createCriteria().andIdIn(request.getIssueIds());
|
||||
List<Issues> issues = issuesMapper.selectByExample(example);
|
||||
List<String> names = issues.stream().map(Issues::getTitle).collect(Collectors.toList());
|
||||
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(request.getIssueIds()), bloBs.getProjectId(), bloBs.getName() + " 关联 " + names, bloBs.getCreateUser(), new LinkedList<>());
|
||||
return JSON.toJSONString(details);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import com.github.pagehelper.PageHelper;
|
|||
import io.metersphere.base.domain.*;
|
||||
import io.metersphere.base.mapper.*;
|
||||
import io.metersphere.base.mapper.ext.ExtTestCaseMapper;
|
||||
import io.metersphere.commons.constants.RoleConstants;
|
||||
import io.metersphere.commons.constants.TestCaseConstants;
|
||||
import io.metersphere.commons.constants.TestCaseReviewStatus;
|
||||
import io.metersphere.commons.constants.UserGroupType;
|
||||
|
@ -93,7 +92,7 @@ public class TestCaseService {
|
|||
TestCaseNodeService testCaseNodeService;
|
||||
|
||||
@Resource
|
||||
UserRoleMapper userRoleMapper;
|
||||
ApiTestCaseMapper apiTestCaseMapper;
|
||||
|
||||
@Resource
|
||||
TestCaseIssueService testCaseIssueService;
|
||||
|
@ -111,6 +110,14 @@ public class TestCaseService {
|
|||
private GroupMapper groupMapper;
|
||||
@Resource
|
||||
private UserGroupMapper userGroupMapper;
|
||||
@Resource
|
||||
private LoadTestMapper loadTestMapper;
|
||||
@Resource
|
||||
private ApiScenarioMapper apiScenarioMapper;
|
||||
@Resource
|
||||
private TestCaseIssuesMapper testCaseIssuesMapper;
|
||||
@Resource
|
||||
private IssuesMapper issuesMapper;
|
||||
|
||||
private void setNode(TestCaseWithBLOBs testCase) {
|
||||
if (StringUtils.isEmpty(testCase.getNodeId()) || "default-module".equals(testCase.getNodeId())) {
|
||||
|
@ -1267,13 +1274,88 @@ public class TestCaseService {
|
|||
TestCaseWithBLOBs bloBs = testCaseMapper.selectByPrimaryKey(id);
|
||||
if (bloBs != null) {
|
||||
List<DetailColumn> columns = ReflexObjectUtil.getColumns(bloBs, TestCaseReference.testCaseColumns);
|
||||
// 关联内容用例内容
|
||||
TestCaseTestExample example = new TestCaseTestExample();
|
||||
example.createCriteria().andTestCaseIdEqualTo(id);
|
||||
List<TestCaseTest> testCaseTests = testCaseTestMapper.selectByExample(example);
|
||||
StringBuilder nameBuilder = new StringBuilder();
|
||||
if (CollectionUtils.isNotEmpty(testCaseTests)) {
|
||||
List<String> testCaseIds = testCaseTests.stream()
|
||||
.filter(user -> user.getTestType().equals("testcase")).map(TestCaseTest::getTestId)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<String> performanceIds = testCaseTests.stream()
|
||||
.filter(user -> user.getTestType().equals("performance")).map(TestCaseTest::getTestId)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<String> automationIds = testCaseTests.stream()
|
||||
.filter(user -> user.getTestType().equals("automation")).map(TestCaseTest::getTestId)
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(testCaseIds)) {
|
||||
ApiTestCaseExample testCaseExample = new ApiTestCaseExample();
|
||||
testCaseExample.createCriteria().andIdIn(testCaseIds);
|
||||
List<ApiTestCase> testCases = apiTestCaseMapper.selectByExample(testCaseExample);
|
||||
List<String> caseNames = testCases.stream().map(ApiTestCase::getName).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(caseNames)) {
|
||||
nameBuilder.append("接口用例:").append("\n").append(caseNames).append("\n");
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(performanceIds)) {
|
||||
LoadTestExample loadTestExample = new LoadTestExample();
|
||||
loadTestExample.createCriteria().andIdIn(performanceIds);
|
||||
List<LoadTest> loadTests = loadTestMapper.selectByExample(loadTestExample);
|
||||
List<String> caseNames = loadTests.stream().map(LoadTest::getName).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(caseNames)) {
|
||||
nameBuilder.append("性能用例:").append("\n").append(caseNames).append("\n");
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(automationIds)) {
|
||||
ApiScenarioExample scenarioExample = new ApiScenarioExample();
|
||||
scenarioExample.createCriteria().andIdIn(automationIds);
|
||||
List<ApiScenario> scenarios = apiScenarioMapper.selectByExample(scenarioExample);
|
||||
List<String> caseNames = scenarios.stream().map(ApiScenario::getName).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(caseNames)) {
|
||||
nameBuilder.append("自动化用例:").append("\n").append(caseNames).append("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
DetailColumn column = new DetailColumn("关联测试", "testcase", nameBuilder.toString(), null);
|
||||
columns.add(column);
|
||||
|
||||
//关联缺陷
|
||||
List<String> issuesNames = new LinkedList<>();
|
||||
TestCaseIssuesExample testCaseIssuesExample = new TestCaseIssuesExample();
|
||||
testCaseIssuesExample.createCriteria().andTestCaseIdEqualTo(bloBs.getId());
|
||||
List<TestCaseIssues> testCaseIssues = testCaseIssuesMapper.selectByExample(testCaseIssuesExample);
|
||||
if (CollectionUtils.isNotEmpty(testCaseIssues)) {
|
||||
List<String> issuesIds = testCaseIssues.stream().map(TestCaseIssues::getIssuesId).collect(Collectors.toList());
|
||||
IssuesExample issuesExample = new IssuesExample();
|
||||
issuesExample.createCriteria().andIdIn(issuesIds);
|
||||
List<Issues> issues = issuesMapper.selectByExample(issuesExample);
|
||||
if (CollectionUtils.isNotEmpty(issues)) {
|
||||
issuesNames = issues.stream().map(Issues::getTitle).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
DetailColumn issuesColumn = new DetailColumn("关联缺陷 ", "issues", String.join(",", issuesNames), null);
|
||||
columns.add(issuesColumn);
|
||||
//附件
|
||||
List<FileMetadata> originFiles = fileService.getFileMetadataByCaseId(id);
|
||||
List<String> fileNames = new LinkedList<>();
|
||||
if (CollectionUtils.isNotEmpty(originFiles)) {
|
||||
fileNames = originFiles.stream().map(FileMetadata::getName).collect(Collectors.toList());
|
||||
}
|
||||
DetailColumn fileColumn = new DetailColumn("附件 ", "files", String.join(",", fileNames), null);
|
||||
columns.add(fileColumn);
|
||||
|
||||
// 增加评论内容
|
||||
List<TestCaseCommentDTO> dtos = testCaseCommentService.getCaseComments(id);
|
||||
List<String> names = new LinkedList<>();
|
||||
if (CollectionUtils.isNotEmpty(dtos)) {
|
||||
List<String> names = dtos.stream().map(TestCaseCommentDTO::getDescription).collect(Collectors.toList());
|
||||
DetailColumn detailColumn = new DetailColumn("评论", "comment", String.join("\n", names), null);
|
||||
columns.add(detailColumn);
|
||||
names = dtos.stream().map(TestCaseCommentDTO::getDescription).collect(Collectors.toList());
|
||||
}
|
||||
DetailColumn detailColumn = new DetailColumn("评论", "comment", String.join("\n", names), null);
|
||||
columns.add(detailColumn);
|
||||
|
||||
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(id), bloBs.getProjectId(), bloBs.getName(), bloBs.getCreateUser(), columns);
|
||||
return JSON.toJSONString(details);
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
</template>
|
||||
</api-base-component>
|
||||
<ms-run :debug="true" :reportId="reportId" :run-data="runData" :env-map="envMap"
|
||||
@runRefresh="runRefresh" ref="runTest"/>
|
||||
@runRefresh="runRefresh" @errorRefresh="errorRefresh" ref="runTest"/>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
@ -371,6 +371,9 @@
|
|||
/*触发执行操作*/
|
||||
this.reportId = getUUID();
|
||||
},
|
||||
errorRefresh(){
|
||||
this.loading = false;
|
||||
},
|
||||
runRefresh(data) {
|
||||
this.request.requestResult = data;
|
||||
this.request.result = undefined;
|
||||
|
|
|
@ -26,29 +26,29 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import MsEditCompleteHttpApi from "./complete/EditCompleteHTTPApi";
|
||||
import MsEditCompleteTcpApi from "./complete/EditCompleteTCPApi";
|
||||
import MsEditCompleteDubboApi from "./complete/EditCompleteDubboApi";
|
||||
import MsEditCompleteSqlApi from "./complete/EditCompleteSQLApi";
|
||||
import MsEditCompleteHttpApi from "./complete/EditCompleteHTTPApi";
|
||||
import MsEditCompleteTcpApi from "./complete/EditCompleteTCPApi";
|
||||
import MsEditCompleteDubboApi from "./complete/EditCompleteDubboApi";
|
||||
import MsEditCompleteSqlApi from "./complete/EditCompleteSQLApi";
|
||||
|
||||
import {Body} from "../model/ApiTestModel";
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
import {createComponent, Request} from "./jmeter/components";
|
||||
import Sampler from "./jmeter/components/sampler/sampler";
|
||||
import {WORKSPACE_ID} from '@/common/js/constants';
|
||||
import {handleCtrlSEvent} from "../../../../../common/js/utils";
|
||||
import {Body} from "../model/ApiTestModel";
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
import {createComponent, Request} from "./jmeter/components";
|
||||
import Sampler from "./jmeter/components/sampler/sampler";
|
||||
import {WORKSPACE_ID} from '@/common/js/constants';
|
||||
import {handleCtrlSEvent} from "../../../../../common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "ApiConfig",
|
||||
components: {MsEditCompleteHttpApi, MsEditCompleteTcpApi, MsEditCompleteDubboApi, MsEditCompleteSqlApi},
|
||||
data() {
|
||||
return {
|
||||
reqUrl: "",
|
||||
request: Sampler,
|
||||
config: {},
|
||||
response: {},
|
||||
maintainerOptions: [],
|
||||
}
|
||||
export default {
|
||||
name: "ApiConfig",
|
||||
components: {MsEditCompleteHttpApi, MsEditCompleteTcpApi, MsEditCompleteDubboApi, MsEditCompleteSqlApi},
|
||||
data() {
|
||||
return {
|
||||
reqUrl: "",
|
||||
request: Sampler,
|
||||
config: {},
|
||||
response: {},
|
||||
maintainerOptions: [],
|
||||
}
|
||||
},
|
||||
props: {
|
||||
currentApi: {},
|
||||
|
@ -173,8 +173,7 @@ export default {
|
|||
} else {
|
||||
this.response = {headers: [], body: new Body(), statusCode: [], type: "HTTP"};
|
||||
}
|
||||
|
||||
if (this.currentApi !== null && this.currentApi.id !== null && this.currentApi.isCopy !== true) {
|
||||
if (this.currentApi && this.currentApi.id && !this.currentApi.isCopy) {
|
||||
this.reqUrl = "/api/definition/update";
|
||||
} else {
|
||||
this.reqUrl = "/api/definition/create";
|
||||
|
|
|
@ -259,6 +259,7 @@
|
|||
},
|
||||
copyCase(data) {
|
||||
let uuid = getUUID();
|
||||
data.request.id = uuid;
|
||||
let obj = {name: "copy_" + data.name, priority: data.priority, active: true, tags: data.tags, request: data.request, uuid: uuid};
|
||||
this.$emit('copyCase', obj);
|
||||
},
|
||||
|
|
|
@ -381,7 +381,7 @@ export class HttpRequest extends Request {
|
|||
}
|
||||
}
|
||||
let url = null;
|
||||
if (environment && this.environment.config.httpConfig
|
||||
if (environment && environment.config && environment.config.httpConfig
|
||||
&& environment.config.httpConfig.conditions && environment.config.httpConfig.conditions.length > 0) {
|
||||
environment.config.httpConfig.conditions.forEach(item => {
|
||||
if (item.type === 'NONE') {
|
||||
|
|
|
@ -74,6 +74,7 @@
|
|||
{id: 'IMPORT', label: this.$t('api_test.api_import.label')},
|
||||
{id: 'EXPORT', label: this.$t('commons.export')},
|
||||
{id: 'ASSOCIATE_CASE', label: this.$t('test_track.review_view.relevance_case')},
|
||||
{id: 'ASSOCIATE_ISSUE', label: this.$t('test_track.case.relate_issue')},
|
||||
{id: 'REVIEW', label: this.$t('test_track.review_view.start_review')},
|
||||
{id: 'COPY', label: this.$t('commons.copy')},
|
||||
{id: 'EXECUTE', label: this.$t('api_test.automation.execute')},
|
||||
|
@ -97,6 +98,7 @@
|
|||
['IMPORT', this.$t('api_test.api_import.label')],
|
||||
['EXPORT', this.$t('commons.export')],
|
||||
['ASSOCIATE_CASE', this.$t('test_track.review_view.relevance_case')],
|
||||
['ASSOCIATE_ISSUE', this.$t('test_track.case.relate_issue')],
|
||||
['REVIEW', this.$t('test_track.review_view.start_review')],
|
||||
['COPY', this.$t('commons.copy')],
|
||||
['EXECUTE', this.$t('api_test.automation.execute')],
|
||||
|
|
|
@ -122,6 +122,7 @@
|
|||
{id: 'IMPORT', label: this.$t('api_test.api_import.label')},
|
||||
{id: 'EXPORT', label: this.$t('commons.export')},
|
||||
{id: 'ASSOCIATE_CASE', label: this.$t('test_track.review_view.relevance_case')},
|
||||
{id: 'ASSOCIATE_ISSUE', label: this.$t('test_track.case.relate_issue')},
|
||||
{id: 'UN_ASSOCIATE_CASE', label: this.$t('test_track.case.unlink')},
|
||||
{id: 'REVIEW', label: this.$t('test_track.review_view.start_review')},
|
||||
{id: 'COPY', label: this.$t('commons.copy')},
|
||||
|
@ -145,6 +146,7 @@
|
|||
['IMPORT', this.$t('api_test.api_import.label')],
|
||||
['EXPORT', this.$t('commons.export')],
|
||||
['ASSOCIATE_CASE', this.$t('test_track.review_view.relevance_case')],
|
||||
['ASSOCIATE_ISSUE', this.$t('test_track.case.relate_issue')],
|
||||
['UN_ASSOCIATE_CASE', this.$t('test_track.case.unlink')],
|
||||
['REVIEW', this.$t('test_track.review_view.start_review')],
|
||||
['COPY', this.$t('commons.copy')],
|
||||
|
|
Loading…
Reference in New Issue