This commit is contained in:
fit2-zhao 2020-09-14 17:09:48 +08:00
commit f306dbc804
12 changed files with 57 additions and 12 deletions

View File

@ -26,5 +26,7 @@ public class Issues implements Serializable {
private String model;
private String projectName;
private static final long serialVersionUID = 1L;
}

View File

@ -6,7 +6,7 @@ import io.metersphere.base.domain.TestResource;
import io.metersphere.commons.constants.ResourceStatusEnum;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.CommonBeanFactory;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.controller.ResultHolder;
import io.metersphere.dto.NodeDTO;
import io.metersphere.i18n.Translator;
import io.metersphere.performance.engine.AbstractEngine;
@ -87,12 +87,14 @@ public class DockerTestEngine extends AbstractEngine {
testRequest.setTestData(context.getTestData());
testRequest.setEnv(context.getEnv());
try {
restTemplate.postForObject(uri, testRequest, String.class);
} catch (Exception e) {
LogUtil.error(e);
ResultHolder result = restTemplate.postForObject(uri, testRequest, ResultHolder.class);
if (result == null) {
MSException.throwException(Translator.get("start_engine_fail"));
}
if (!result.isSuccess()) {
MSException.throwException(result.getMessage());
}
}
@Override
@ -105,12 +107,13 @@ public class DockerTestEngine extends AbstractEngine {
Integer port = node.getPort();
String uri = String.format(BASE_URL + "/jmeter/container/stop/" + testId, ip, port);
try {
restTemplateWithTimeOut.getForObject(uri, String.class);
} catch (Exception e) {
LogUtil.error("stop load test fail... " + testId, e);
ResultHolder result = restTemplateWithTimeOut.getForObject(uri, ResultHolder.class);
if (result == null) {
MSException.throwException(Translator.get("container_delete_fail"));
}
if (!result.isSuccess()) {
MSException.throwException(result.getMessage());
}
});
}
}

View File

@ -1,5 +1,6 @@
package io.metersphere.track.domain;
import io.metersphere.base.domain.Project;
import io.metersphere.base.domain.TestCaseNode;
import io.metersphere.base.domain.TestCaseNodeExample;
import io.metersphere.base.mapper.TestCaseNodeMapper;
@ -52,6 +53,9 @@ public class ReportResultComponent extends ReportComponent {
nodeTrees.forEach(rootNode -> {
TestCaseReportModuleResultDTO moduleResult = moduleResultMap.get(rootNode.getId());
if (moduleResult != null) {
TestCaseNodeService testCaseNodeService = (TestCaseNodeService) CommonBeanFactory.getBean("testCaseNodeService");
Project project = testCaseNodeService.getProjectByNode(rootNode.getId());
moduleResult.setProjectName(project.getName());
moduleResult.setModuleName(rootNode.getName());
}
});

View File

@ -20,4 +20,5 @@ public class TestCaseReportModuleResultDTO {
private Integer failureCount;
private Integer blockingCount;
private Integer underwayCount;
private String projectName;
}

View File

@ -498,4 +498,12 @@ public class TestCaseNodeService {
}
}
public Project getProjectByNode(String nodeId) {
TestCaseNodeExample example = new TestCaseNodeExample();
example.createCriteria().andIdEqualTo(nodeId);
List<TestCaseNode> testCaseNodes = testCaseNodeMapper.selectByExample(example);
String projectId = testCaseNodes.get(0).getProjectId();
return projectMapper.selectByPrimaryKey(projectId);
}
}

View File

@ -273,6 +273,9 @@ public class TestPlanService {
queryTestPlanRequest.setId(planId);
TestPlanDTO testPlan = extTestPlanMapper.list(queryTestPlanRequest).get(0);
String projectName = getProjectNameByPlanId(planId);
testPlan.setProjectName(projectName);
TestCaseReport testCaseReport = testCaseReportMapper.selectByPrimaryKey(testPlan.getReportId());
JSONObject content = JSONObject.parseObject(testCaseReport.getContent());
JSONArray componentIds = content.getJSONArray("components");
@ -286,6 +289,7 @@ public class TestPlanService {
if (issue.size() > 0) {
for (Issues i : issue) {
i.setModel(testCase.getNodePath());
i.setProjectName(testCase.getProjectName());
String des = i.getDescription().replaceAll("<p>", "").replaceAll("</p>", "");
i.setDescription(des);
if (i.getLastmodify() == null || i.getLastmodify() == "") {

View File

@ -15,6 +15,11 @@
:label="$t('test_track.module.module')"
show-overflow-tooltip>
</el-table-column>
<el-table-column
prop="projectName"
:label="$t('test_track.module.project_name')"
show-overflow-tooltip>
</el-table-column>
<el-table-column
prop="title"
:label="$t('test_track.module.title')"

View File

@ -50,6 +50,12 @@
show-overflow-tooltip>
</el-table-column>
<el-table-column
prop="projectName"
:label="$t('test_track.case.project_name')"
show-overflow-tooltip>
</el-table-column>
<el-table-column
prop="executorName"
:label="$t('test_track.plan_view.executor')">

View File

@ -13,6 +13,12 @@
:label="$t('test_track.module.module')"
>
</el-table-column>
<el-table-column
prop="projectName"
:label="$t('test_track.module.project_name')"
show-overflow-tooltip
>
</el-table-column>
<el-table-column
prop="caseCount"
:label="$t('test_track.plan_view.case_count')"

View File

@ -643,6 +643,7 @@ export default {
batch_move_case: 'Batch move',
batch_delete_case: 'Batch delete',
batch_unlink: 'Batch Unlink',
project_name: "Project",
import: {
import: "Import test case",
case_import: "Import test case",
@ -698,7 +699,8 @@ export default {
describe: "Describe",
status: "Status",
current_owner: "Current Owner",
creation_time: "Creation time"
creation_time: "Creation time",
project_name: "Project"
},
home: {
recent_test: "Recent test",

View File

@ -646,6 +646,7 @@ export default {
batch_move_case: '批量移动用例',
batch_delete_case: '批量删除用例',
batch_unlink: '批量取消关联',
project_name: '所属项目',
import: {
import: "导入用例",
case_import: "导入测试用例",
@ -701,7 +702,8 @@ export default {
status: "状态",
describe: "描述",
current_owner: "处理人",
creation_time: "创建时间"
creation_time: "创建时间",
project_name: "所属项目"
},
home: {
recent_test: "最近测试",

View File

@ -643,6 +643,7 @@ export default {
batch_move_case: '批量移動用例',
batch_delete_case: '批量刪除用例',
batch_unlink: '批量取消關聯',
project_name: '所屬項目',
import: {
import: "導入用例",
case_import: "導入測試用例",
@ -698,7 +699,8 @@ export default {
status: "狀態",
describe: "描述",
current_owner: "處理人",
creation_time: "創建時間"
creation_time: "創建時間",
project_name: "所屬項目"
},
home: {
recent_test: "最近測試",