parent
c2b5ed5dfc
commit
4807af0c42
|
@ -11,6 +11,7 @@ import java.util.List;
|
|||
public interface ExtTestPlanLoadCaseMapper {
|
||||
|
||||
List<String> selectIdsNotInPlan(@Param("request") LoadCaseRequest request);
|
||||
|
||||
List<TestPlanLoadCaseDTO> selectTestPlanLoadCaseList(@Param("request") LoadCaseRequest request);
|
||||
|
||||
List<TestPlanLoadCaseDTO> selectByIdIn(@Param("request") LoadCaseRequest request);
|
||||
|
@ -26,15 +27,16 @@ public interface ExtTestPlanLoadCaseMapper {
|
|||
List<PlanReportCaseDTO> selectForPlanReport(String planId);
|
||||
|
||||
List<TestPlanLoadCaseDTO> getCases(@Param("planId") String planId, @Param("status") String status);
|
||||
List<TestPlanLoadCaseDTO> getCasesByIds(@Param("ids") Collection<String> ids, @Param("planId") String planId, @Param("status") String status);
|
||||
|
||||
List<TestPlanLoadCaseDTO> getCasesByIds(@Param("ids") Collection<String> ids, @Param("reportIds") Collection<String> reportIds);
|
||||
|
||||
List<String> selectPlanIds();
|
||||
|
||||
List<String> getIdsOrderByUpdateTime(@Param("planId") String planId);
|
||||
|
||||
Long getPreOrder(@Param("planId")String planId, @Param("baseOrder") Long baseOrder);
|
||||
Long getPreOrder(@Param("planId") String planId, @Param("baseOrder") Long baseOrder);
|
||||
|
||||
Long getLastOrder(@Param("planId")String planId, @Param("baseOrder") Long baseOrder);
|
||||
Long getLastOrder(@Param("planId") String planId, @Param("baseOrder") Long baseOrder);
|
||||
|
||||
List<String> selectIdByLoadCaseReportIdAndStatusIsRun(String reportId);
|
||||
|
||||
|
|
|
@ -345,17 +345,18 @@
|
|||
|
||||
<select id="getCasesByIds" resultType="io.metersphere.track.dto.TestPlanLoadCaseDTO">
|
||||
select tplc.id, lt.id as caseId, lt.name, lt.num, lt.project_id,
|
||||
tplc.status ,tplc.create_user, tplc.load_report_id
|
||||
ltr.status ,tplc.create_user, tplc.load_report_id,ltr.id AS reportId
|
||||
from test_plan_load_case tplc
|
||||
inner join load_test lt on tplc.load_case_id = lt.id
|
||||
<if test="status != null">
|
||||
and tplc.status = 'error'
|
||||
</if>
|
||||
where tplc.test_plan_id = #{planId}
|
||||
and lt.id IN
|
||||
inner join load_test_report ltr ON ltr.test_id = lt.id
|
||||
where tplc.id IN
|
||||
<foreach collection="ids" item="id" separator="," open="(" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
and ltr.id IN
|
||||
<foreach collection="reportIds" item="id" separator="," open="(" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectPlanIds" resultType="java.lang.String">
|
||||
|
|
|
@ -408,8 +408,8 @@ public class TestPlanLoadCaseService {
|
|||
return buildCases(cases);
|
||||
}
|
||||
|
||||
public List<TestPlanLoadCaseDTO> getAllCases(Collection<String> ids, String planId, String status) {
|
||||
List<TestPlanLoadCaseDTO> cases = extTestPlanLoadCaseMapper.getCasesByIds(ids, planId, status);
|
||||
public List<TestPlanLoadCaseDTO> getAllCases(Collection<String> ids, Collection<String> reportIds) {
|
||||
List<TestPlanLoadCaseDTO> cases = extTestPlanLoadCaseMapper.getCasesByIds(ids, reportIds);
|
||||
return buildCases(cases);
|
||||
}
|
||||
|
||||
|
|
|
@ -1071,16 +1071,16 @@ public class TestPlanService {
|
|||
|
||||
|
||||
//执行接口案例任务
|
||||
Map<String,String> apiCaseReportMap = this.executeApiTestCase(triggerMode, planReportId,userId, new ArrayList<>(reportInfoDTO.getApiTestCaseDataMap().keySet()), runModeConfig);
|
||||
Map<String, String> apiCaseReportMap = this.executeApiTestCase(triggerMode, planReportId, userId, new ArrayList<>(reportInfoDTO.getApiTestCaseDataMap().keySet()), runModeConfig);
|
||||
//执行场景执行任务
|
||||
Map<String,String> scenarioReportMap = this.executeScenarioCase(planReportId, testPlanID, projectID, runModeConfig, triggerMode, userId, reportInfoDTO.getPlanScenarioIdMap());
|
||||
Map<String, String> scenarioReportMap = this.executeScenarioCase(planReportId, testPlanID, projectID, runModeConfig, triggerMode, userId, reportInfoDTO.getPlanScenarioIdMap());
|
||||
//执行性能测试任务
|
||||
Map<String,String> loadCaseReportMap = this.executeLoadCaseTask(runModeConfig, triggerMode, reportInfoDTO.getPerformanceIdMap());
|
||||
testPlanReportService.createTestPlanReportContentReportIds(planReportId, apiCaseReportMap,scenarioReportMap,loadCaseReportMap);
|
||||
Map<String, String> loadCaseReportMap = this.executeLoadCaseTask(runModeConfig, triggerMode, reportInfoDTO.getPerformanceIdMap());
|
||||
testPlanReportService.createTestPlanReportContentReportIds(planReportId, apiCaseReportMap, scenarioReportMap, loadCaseReportMap);
|
||||
return planReportId;
|
||||
}
|
||||
|
||||
private Map<String,String> executeApiTestCase(String triggerMode, String planReportId, String userId, List<String> planCaseIds, RunModeConfigDTO runModeConfig) {
|
||||
private Map<String, String> executeApiTestCase(String triggerMode, String planReportId, String userId, List<String> planCaseIds, RunModeConfigDTO runModeConfig) {
|
||||
BatchRunDefinitionRequest request = new BatchRunDefinitionRequest();
|
||||
request.setTriggerMode(triggerMode);
|
||||
request.setPlanIds(planCaseIds);
|
||||
|
@ -1091,7 +1091,7 @@ public class TestPlanService {
|
|||
return this.parseMsExecREsponseDTOToTestIdReportMap(dtoList);
|
||||
}
|
||||
|
||||
private Map<String,String> executeScenarioCase(String planReportId, String testPlanID, String projectID, RunModeConfigDTO runModeConfig, String triggerMode, String userId, Map<String, String> planScenarioIdMap) {
|
||||
private Map<String, String> executeScenarioCase(String planReportId, String testPlanID, String projectID, RunModeConfigDTO runModeConfig, String triggerMode, String userId, Map<String, String> planScenarioIdMap) {
|
||||
if (!planScenarioIdMap.isEmpty()) {
|
||||
SchedulePlanScenarioExecuteRequest scenarioRequest = new SchedulePlanScenarioExecuteRequest();
|
||||
String senarionReportID = UUID.randomUUID().toString();
|
||||
|
@ -1116,19 +1116,19 @@ public class TestPlanService {
|
|||
scenarioRequest.setTestPlanID(testPlanID);
|
||||
scenarioRequest.setTestPlanReportId(planReportId);
|
||||
scenarioRequest.setConfig(runModeConfig);
|
||||
List<MsExecResponseDTO> dtoList = this.scenarioRunModeConfig(scenarioRequest);
|
||||
List<MsExecResponseDTO> dtoList = this.scenarioRunModeConfig(scenarioRequest);
|
||||
return this.parseMsExecREsponseDTOToTestIdReportMap(dtoList);
|
||||
}else {
|
||||
} else {
|
||||
return new HashMap<>();
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, String> parseMsExecREsponseDTOToTestIdReportMap(List<MsExecResponseDTO> dtoList) {
|
||||
Map<String,String> returnMap = new HashMap<>();
|
||||
if(CollectionUtils.isNotEmpty(dtoList)){
|
||||
dtoList.forEach( item -> {
|
||||
if(StringUtils.isNotEmpty(item.getTestId()) && StringUtils.isNotEmpty(item.getReportId())){
|
||||
returnMap.put(item.getTestId(),item.getReportId());
|
||||
Map<String, String> returnMap = new HashMap<>();
|
||||
if (CollectionUtils.isNotEmpty(dtoList)) {
|
||||
dtoList.forEach(item -> {
|
||||
if (StringUtils.isNotEmpty(item.getTestId()) && StringUtils.isNotEmpty(item.getReportId())) {
|
||||
returnMap.put(item.getTestId(), item.getReportId());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1676,18 +1676,14 @@ public class TestPlanService {
|
|||
}
|
||||
}
|
||||
|
||||
public void buildLoadReport(TestPlanSimpleReportDTO report, JSONObject config, Map<String, String> loadCaseReportMap, String planId, boolean saveResponse) {
|
||||
public void buildLoadReport(TestPlanSimpleReportDTO report, JSONObject config, Map<String, String> loadCaseReportMap, boolean saveResponse) {
|
||||
if (MapUtils.isEmpty(loadCaseReportMap)) {
|
||||
return;
|
||||
}
|
||||
if (checkReportConfig(config, "load")) {
|
||||
List<TestPlanLoadCaseDTO> allCases = null;
|
||||
if (checkReportConfig(config, "load", "all")) {
|
||||
allCases = testPlanLoadCaseService.getAllCases(loadCaseReportMap.keySet(), planId, null);
|
||||
for (TestPlanLoadCaseDTO dto : allCases) {
|
||||
String reportId = loadCaseReportMap.get(dto.getId());
|
||||
dto.setReportId(reportId);
|
||||
}
|
||||
allCases = testPlanLoadCaseService.getAllCases(loadCaseReportMap.keySet(), loadCaseReportMap.values());
|
||||
if (saveResponse) {
|
||||
buildLoadResponse(allCases);
|
||||
}
|
||||
|
@ -1718,7 +1714,7 @@ public class TestPlanService {
|
|||
TestPlanSimpleReportDTO report = getReport(testPlanReport.getTestPlanId(), testPlanExecuteReportDTO);
|
||||
buildFunctionalReport(report, config, testPlanReport.getTestPlanId());
|
||||
buildApiReport(report, config, testPlanExecuteReportDTO);
|
||||
buildLoadReport(report, config, testPlanExecuteReportDTO.getTestPlanLoadCaseIdAndReportIdMap(), testPlanReport.getTestPlanId(), false);
|
||||
buildLoadReport(report, config, testPlanExecuteReportDTO.getTestPlanLoadCaseIdAndReportIdMap(), false);
|
||||
return report;
|
||||
} else {
|
||||
return null;
|
||||
|
|
|
@ -1,34 +1,34 @@
|
|||
<template>
|
||||
<el-card>
|
||||
<el-scrollbar>
|
||||
<el-scrollbar>
|
||||
<el-table
|
||||
row-key="id"
|
||||
@row-click="rowClick"
|
||||
:highlight-current-row="true"
|
||||
:data="loadTestCases">
|
||||
row-key="id"
|
||||
@row-click="rowClick"
|
||||
:highlight-current-row="true"
|
||||
:data="loadTestCases">
|
||||
<el-table-column
|
||||
prop="num"
|
||||
:label="$t('commons.id')"
|
||||
show-overflow-tooltip>
|
||||
prop="num"
|
||||
:label="$t('commons.id')"
|
||||
show-overflow-tooltip>
|
||||
<template v-slot:default="{row}">
|
||||
{{row.isCustomNum ? row.customNum : row.num }}
|
||||
{{ row.isCustomNum ? row.customNum : row.num }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="name"
|
||||
:label="$t('commons.name')"
|
||||
show-overflow-tooltip>
|
||||
prop="name"
|
||||
:label="$t('commons.name')"
|
||||
show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="userName"
|
||||
:label="$t('commons.create_user')">
|
||||
prop="userName"
|
||||
:label="$t('commons.create_user')">
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="status"
|
||||
column-key="status"
|
||||
:label="$t('test_track.plan_view.execute_result')">
|
||||
prop="status"
|
||||
column-key="status"
|
||||
:label="$t('test_track.plan_view.execute_result')">
|
||||
<template v-slot:default="{row}">
|
||||
<el-tag size="mini" type="danger" v-if="row.status === 'error'">
|
||||
{{ row.status }}
|
||||
|
@ -39,7 +39,12 @@
|
|||
<el-tag size="mini" v-else-if="row.status === 'run'">
|
||||
{{ row.status }}
|
||||
</el-tag>
|
||||
<span v-else>-</span>
|
||||
<el-tag size="mini" v-else-if="row.status === 'Completed'">
|
||||
{{ row.status }}
|
||||
</el-tag>
|
||||
<el-tag size="mini" v-else>
|
||||
{{ row.status }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
@ -58,6 +63,7 @@ import {
|
|||
getSharePlanLoadAllCase,
|
||||
getSharePlanLoadFailureCase
|
||||
} from "@/network/test-plan";
|
||||
|
||||
export default {
|
||||
name: "LoadFailureResult",
|
||||
components: {StatusTableItem, MethodTableItem, TypeTableItem},
|
||||
|
@ -72,7 +78,7 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
loadTestCases: []
|
||||
loadTestCases: []
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
|
Loading…
Reference in New Issue