fix(测试计划): 修复测试计划执行报告看不到性能测试用例的问题

修复测试计划执行报告看不到性能测试用例的问题
This commit is contained in:
song-tianyang 2022-01-12 15:36:39 +08:00 committed by song-tianyang
parent c2b5ed5dfc
commit 4807af0c42
5 changed files with 55 additions and 50 deletions

View File

@ -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,7 +27,8 @@ 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();

View File

@ -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">

View File

@ -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);
}

View File

@ -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;

View File

@ -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},