fix: ui报告统计不正确 (#12117)

Co-authored-by: chenjianxing <jianxing.chen@fit2cloud.com>
This commit is contained in:
MeterSphere Bot 2022-03-30 15:51:16 +08:00 committed by GitHub
parent b62069dec5
commit 812697d61a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 45 additions and 1 deletions

View File

@ -507,6 +507,8 @@ public class ApiScenarioReportStructureService {
example.createCriteria().andReportIdEqualTo(reportId);
List<ApiScenarioReportResult> reportResults = reportResultMapper.selectByExampleWithBLOBs(example);
removeUiResultIfNotStep(reportResults, reportId);
ApiScenarioReportStructureExample structureExample = new ApiScenarioReportStructureExample();
structureExample.createCriteria().andReportIdEqualTo(reportId);
List<ApiScenarioReportStructureWithBLOBs> reportStructureWithBLOBs = mapper.selectByExampleWithBLOBs(structureExample);
@ -553,6 +555,28 @@ public class ApiScenarioReportStructureService {
return reportDTO;
}
/**
* UI 测试结果统计去掉前后置或其他不算步骤的执行结果
* @param reportResults
* @param reportId
*/
private void removeUiResultIfNotStep(List<ApiScenarioReportResult> reportResults, String reportId) {
ApiScenarioReport report = scenarioReportMapper.selectByPrimaryKey(reportId);
if (report.getReportType() != null && report.getReportType().startsWith("UI")) {
Iterator<ApiScenarioReportResult> iterator = reportResults.iterator();
while (iterator.hasNext()) {
ApiScenarioReportResult item = iterator.next();
String result = new String(item.getContent(), StandardCharsets.UTF_8);
if (StringUtils.isNotBlank(result)) {
Boolean isNoStep = JSONObject.parseObject(result).getBoolean("isNoStep");
if (BooleanUtils.isTrue(isNoStep)) {
iterator.remove();
}
}
}
}
}
private void countAllUnexecute(List<StepTreeDTO> stepList, AtomicLong allUnExecute) {
for (StepTreeDTO step : stepList) {
if (step.getValue() != null) {

View File

@ -310,6 +310,9 @@ export default {
this.recursiveSorting(this.fullTreeNodes);
this.reload();
}
if ("Running" !== this.report.status) {
this.$emit('finish');
}
});
},
runningNodeChild(arr, resourceId) {

@ -1 +1 @@
Subproject commit 69707e80dc499a74a74165896649c2d4a2de8b4e
Subproject commit dc96e7cba5560b3d9d67b6c9a9bcb3f53cc50bb8

View File

@ -82,6 +82,23 @@ export let CUSTOM_TABLE_HEADER = {
{id: 'passRate', key: 'b', label: 'api_test.automation.passing_rate'},
{id: 'createTime', key: 'c', label: 'commons.create_time'},
],
//场景测试
UI_SCENARIO: [
{id: 'num', key: '1', label: "ID"},
{id: 'name', key: '2', label: 'api_report.scenario_name'},
{id: 'level', key: '3', label: 'api_test.automation.case_level'},
{id: 'status', key: '4', label: 'test_track.plan.plan_status'},
{id: 'tags', key: '5', label: 'commons.tag'},
{id: 'versionId', key: 'f', label: 'project.version.name', xpack: true},
{id: 'creatorName', key: 'd', label: 'api_test.automation.creator'},
{id: 'principalName', key: '6', label: 'api_test.definition.api_principal'},
{id: 'environmentMap', key: 'e', label: 'commons.environment'},
{id: 'updateTime', key: '7', label: 'api_test.definition.api_last_time'},
{id: 'stepTotal', key: '8', label: 'api_test.automation.step'},
{id: 'lastResult', key: 'a', label: 'api_test.automation.last_result'},
{id: 'passRate', key: 'b', label: 'api_test.automation.passing_rate'},
{id: 'createTime', key: 'c', label: 'commons.create_time'},
],
//用例评审
TEST_CASE_REVIEW: [
{id: 'name', key: '1', label: 'test_track.review.review_name'},