fix(UI 自动化) UI测试报告不同步测试计划,无消息发送

--bug=1015636 --user=张大海 【UI 测试】测试计划 UI 测试结果与总报告结果不同步 https://www.tapd.cn/55049933/s/1223786
--bug=1015719 --user=张大海 【测试跟踪】测试计划 - 只关联UI自动化场景 - 不发送消息通知 https://www.tapd.cn/55049933/s/1223784
This commit is contained in:
zhangdahai112 2022-08-15 18:27:10 +08:00 committed by zhangdahai112
parent 10bcfe1378
commit d10a5c25c2
6 changed files with 249 additions and 42 deletions

View File

@ -37,6 +37,8 @@ public class TestPlanReport implements Serializable {
private Boolean isNew; private Boolean isNew;
private Boolean isUiScenarioExecuting;
private String runInfo; private String runInfo;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@ -1143,6 +1143,66 @@ public class TestPlanReportExample {
addCriterion("is_new not between", value1, value2, "isNew"); addCriterion("is_new not between", value1, value2, "isNew");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIsUiScenarioExecutingIsNull() {
addCriterion("is_ui_scenario_executing is null");
return (Criteria) this;
}
public Criteria andIsUiScenarioExecutingIsNotNull() {
addCriterion("is_ui_scenario_executing is not null");
return (Criteria) this;
}
public Criteria andIsUiScenarioExecutingEqualTo(Boolean value) {
addCriterion("is_ui_scenario_executing =", value, "isUiScenarioExecuting");
return (Criteria) this;
}
public Criteria andIsUiScenarioExecutingNotEqualTo(Boolean value) {
addCriterion("is_ui_scenario_executing <>", value, "isUiScenarioExecuting");
return (Criteria) this;
}
public Criteria andIsUiScenarioExecutingGreaterThan(Boolean value) {
addCriterion("is_ui_scenario_executing >", value, "isUiScenarioExecuting");
return (Criteria) this;
}
public Criteria andIsUiScenarioExecutingGreaterThanOrEqualTo(Boolean value) {
addCriterion("is_ui_scenario_executing >=", value, "isUiScenarioExecuting");
return (Criteria) this;
}
public Criteria andIsUiScenarioExecutingLessThan(Boolean value) {
addCriterion("is_ui_scenario_executing <", value, "isUiScenarioExecuting");
return (Criteria) this;
}
public Criteria andIsUiScenarioExecutingLessThanOrEqualTo(Boolean value) {
addCriterion("is_ui_scenario_executing <=", value, "isUiScenarioExecuting");
return (Criteria) this;
}
public Criteria andIsUiScenarioExecutingIn(List<Boolean> values) {
addCriterion("is_ui_scenario_executing in", values, "isUiScenarioExecuting");
return (Criteria) this;
}
public Criteria andIsUiScenarioExecutingNotIn(List<Boolean> values) {
addCriterion("is_ui_scenario_executing not in", values, "isUiScenarioExecuting");
return (Criteria) this;
}
public Criteria andIsUiScenarioExecutingBetween(Boolean value1, Boolean value2) {
addCriterion("is_ui_scenario_executing between", value1, value2, "isUiScenarioExecuting");
return (Criteria) this;
}
public Criteria andIsUiScenarioExecutingNotBetween(Boolean value1, Boolean value2) {
addCriterion("is_ui_scenario_executing not between", value1, value2, "isUiScenarioExecuting");
return (Criteria) this;
}
} }
public static class Criteria extends GeneratedCriteria { public static class Criteria extends GeneratedCriteria {

View File

@ -18,6 +18,7 @@
<result column="principal" jdbcType="VARCHAR" property="principal" /> <result column="principal" jdbcType="VARCHAR" property="principal" />
<result column="components" jdbcType="VARCHAR" property="components" /> <result column="components" jdbcType="VARCHAR" property="components" />
<result column="is_new" jdbcType="BIT" property="isNew" /> <result column="is_new" jdbcType="BIT" property="isNew" />
<result column="is_ui_scenario_executing" jdbcType="BIT" property="isUiScenarioExecuting" />
</resultMap> </resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.TestPlanReport"> <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.TestPlanReport">
<result column="run_info" jdbcType="LONGVARCHAR" property="runInfo" /> <result column="run_info" jdbcType="LONGVARCHAR" property="runInfo" />
@ -83,7 +84,7 @@
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, test_plan_id, create_time, update_time, `name`, `status`, trigger_mode, creator, id, test_plan_id, create_time, update_time, `name`, `status`, trigger_mode, creator,
start_time, end_time, is_api_case_executing, is_scenario_executing, is_performance_executing, start_time, end_time, is_api_case_executing, is_scenario_executing, is_performance_executing,
principal, components, is_new principal, components, is_new, is_ui_scenario_executing
</sql> </sql>
<sql id="Blob_Column_List"> <sql id="Blob_Column_List">
run_info run_info
@ -142,13 +143,15 @@
trigger_mode, creator, start_time, trigger_mode, creator, start_time,
end_time, is_api_case_executing, is_scenario_executing, end_time, is_api_case_executing, is_scenario_executing,
is_performance_executing, principal, components, is_performance_executing, principal, components,
is_new, run_info) is_new, is_ui_scenario_executing, run_info
)
values (#{id,jdbcType=VARCHAR}, #{testPlanId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, values (#{id,jdbcType=VARCHAR}, #{testPlanId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
#{updateTime,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{updateTime,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
#{triggerMode,jdbcType=VARCHAR}, #{creator,jdbcType=VARCHAR}, #{startTime,jdbcType=BIGINT}, #{triggerMode,jdbcType=VARCHAR}, #{creator,jdbcType=VARCHAR}, #{startTime,jdbcType=BIGINT},
#{endTime,jdbcType=BIGINT}, #{isApiCaseExecuting,jdbcType=BIT}, #{isScenarioExecuting,jdbcType=BIT}, #{endTime,jdbcType=BIGINT}, #{isApiCaseExecuting,jdbcType=BIT}, #{isScenarioExecuting,jdbcType=BIT},
#{isPerformanceExecuting,jdbcType=BIT}, #{principal,jdbcType=VARCHAR}, #{components,jdbcType=VARCHAR}, #{isPerformanceExecuting,jdbcType=BIT}, #{principal,jdbcType=VARCHAR}, #{components,jdbcType=VARCHAR},
#{isNew,jdbcType=BIT}, #{runInfo,jdbcType=LONGVARCHAR}) #{isNew,jdbcType=BIT}, #{isUiScenarioExecuting,jdbcType=BIT}, #{runInfo,jdbcType=LONGVARCHAR}
)
</insert> </insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestPlanReport"> <insert id="insertSelective" parameterType="io.metersphere.base.domain.TestPlanReport">
insert into test_plan_report insert into test_plan_report
@ -201,6 +204,9 @@
<if test="isNew != null"> <if test="isNew != null">
is_new, is_new,
</if> </if>
<if test="isUiScenarioExecuting != null">
is_ui_scenario_executing,
</if>
<if test="runInfo != null"> <if test="runInfo != null">
run_info, run_info,
</if> </if>
@ -254,6 +260,9 @@
<if test="isNew != null"> <if test="isNew != null">
#{isNew,jdbcType=BIT}, #{isNew,jdbcType=BIT},
</if> </if>
<if test="isUiScenarioExecuting != null">
#{isUiScenarioExecuting,jdbcType=BIT},
</if>
<if test="runInfo != null"> <if test="runInfo != null">
#{runInfo,jdbcType=LONGVARCHAR}, #{runInfo,jdbcType=LONGVARCHAR},
</if> </if>
@ -316,6 +325,9 @@
<if test="record.isNew != null"> <if test="record.isNew != null">
is_new = #{record.isNew,jdbcType=BIT}, is_new = #{record.isNew,jdbcType=BIT},
</if> </if>
<if test="record.isUiScenarioExecuting != null">
is_ui_scenario_executing = #{record.isUiScenarioExecuting,jdbcType=BIT},
</if>
<if test="record.runInfo != null"> <if test="record.runInfo != null">
run_info = #{record.runInfo,jdbcType=LONGVARCHAR}, run_info = #{record.runInfo,jdbcType=LONGVARCHAR},
</if> </if>
@ -342,6 +354,7 @@
principal = #{record.principal,jdbcType=VARCHAR}, principal = #{record.principal,jdbcType=VARCHAR},
components = #{record.components,jdbcType=VARCHAR}, components = #{record.components,jdbcType=VARCHAR},
is_new = #{record.isNew,jdbcType=BIT}, is_new = #{record.isNew,jdbcType=BIT},
is_ui_scenario_executing = #{record.isUiScenarioExecuting,jdbcType=BIT},
run_info = #{record.runInfo,jdbcType=LONGVARCHAR} run_info = #{record.runInfo,jdbcType=LONGVARCHAR}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
@ -364,7 +377,8 @@
is_performance_executing = #{record.isPerformanceExecuting,jdbcType=BIT}, is_performance_executing = #{record.isPerformanceExecuting,jdbcType=BIT},
principal = #{record.principal,jdbcType=VARCHAR}, principal = #{record.principal,jdbcType=VARCHAR},
components = #{record.components,jdbcType=VARCHAR}, components = #{record.components,jdbcType=VARCHAR},
is_new = #{record.isNew,jdbcType=BIT} is_new = #{record.isNew,jdbcType=BIT},
is_ui_scenario_executing = #{record.isUiScenarioExecuting,jdbcType=BIT}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
@ -417,6 +431,9 @@
<if test="isNew != null"> <if test="isNew != null">
is_new = #{isNew,jdbcType=BIT}, is_new = #{isNew,jdbcType=BIT},
</if> </if>
<if test="isUiScenarioExecuting != null">
is_ui_scenario_executing = #{isUiScenarioExecuting,jdbcType=BIT},
</if>
<if test="runInfo != null"> <if test="runInfo != null">
run_info = #{runInfo,jdbcType=LONGVARCHAR}, run_info = #{runInfo,jdbcType=LONGVARCHAR},
</if> </if>
@ -440,6 +457,7 @@
principal = #{principal,jdbcType=VARCHAR}, principal = #{principal,jdbcType=VARCHAR},
components = #{components,jdbcType=VARCHAR}, components = #{components,jdbcType=VARCHAR},
is_new = #{isNew,jdbcType=BIT}, is_new = #{isNew,jdbcType=BIT},
is_ui_scenario_executing = #{isUiScenarioExecuting,jdbcType=BIT},
run_info = #{runInfo,jdbcType=LONGVARCHAR} run_info = #{runInfo,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
@ -459,7 +477,8 @@
is_performance_executing = #{isPerformanceExecuting,jdbcType=BIT}, is_performance_executing = #{isPerformanceExecuting,jdbcType=BIT},
principal = #{principal,jdbcType=VARCHAR}, principal = #{principal,jdbcType=VARCHAR},
components = #{components,jdbcType=VARCHAR}, components = #{components,jdbcType=VARCHAR},
is_new = #{isNew,jdbcType=BIT} is_new = #{isNew,jdbcType=BIT},
is_ui_scenario_executing = #{isUiScenarioExecuting,jdbcType=BIT}
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
</mapper> </mapper>

View File

@ -21,14 +21,13 @@ public class TestPlanReportSaveRequest {
private boolean countResources; private boolean countResources;
private boolean apiCaseIsExecuting; private boolean apiCaseIsExecuting;
private boolean scenarioIsExecuting; private boolean scenarioIsExecuting;
private boolean uiScenarioIsExecuting;
private boolean performanceIsExecuting; private boolean performanceIsExecuting;
// private String apiCaseIdListJSON; Map<String, String> apiCaseIdMap;
// private String scenarioIdListJSON; Map<String, String> scenarioIdMap;
// private String performanceIdListJSON; Map<String, String> uiScenarioIdMap;
Map<String,String> apiCaseIdMap; Map<String, String> performanceIdMap;
Map<String,String> scenarioIdMap;
Map<String,String> performanceIdMap;
public TestPlanReportSaveRequest(String reportID, String planId, String userId, String triggerMode) { public TestPlanReportSaveRequest(String reportID, String planId, String userId, String triggerMode) {
this.reportID = reportID; this.reportID = reportID;
@ -39,21 +38,106 @@ public class TestPlanReportSaveRequest {
this.countResources = true; this.countResources = true;
} }
public TestPlanReportSaveRequest(String reportID, String planId, String userId, String triggerMode, boolean apiCaseIsExecuting, boolean scenarioIsExecuting, boolean performanceIsExecuting, public TestPlanReportSaveRequest(Builder builder) {
Map<String,String> apiCaseIdMap, Map<String,String> scenarioIdMap, Map<String,String> performanceIdMap) { this.reportID = builder.reportID;
this.planId = builder.planId;
this.userId = builder.userId;
this.triggerMode = builder.triggerMode;
this.countResources = builder.countResources;
this.apiCaseIsExecuting = builder.apiCaseIsExecuting;
this.scenarioIsExecuting = builder.scenarioIsExecuting;
this.uiScenarioIsExecuting = builder.uiScenarioIsExecuting;
this.performanceIsExecuting = builder.performanceIsExecuting;
this.apiCaseIdMap = builder.apiCaseIdMap;
this.scenarioIdMap = builder.scenarioIdMap;
this.uiScenarioIdMap = builder.uiScenarioIdMap;
this.performanceIdMap = builder.performanceIdMap;
}
public static class Builder {
private String reportID;
private String planId;
private String userId;
private String triggerMode;
private boolean countResources;
private boolean apiCaseIsExecuting;
private boolean scenarioIsExecuting;
private boolean uiScenarioIsExecuting;
private boolean performanceIsExecuting;
Map<String, String> apiCaseIdMap;
Map<String, String> scenarioIdMap;
Map<String, String> uiScenarioIdMap;
Map<String, String> performanceIdMap;
public Builder setReportID(String reportID) {
this.reportID = reportID; this.reportID = reportID;
return this;
}
public Builder setPlanId(String planId) {
this.planId = planId; this.planId = planId;
return this;
}
public Builder setUserId(String userId) {
this.userId = userId; this.userId = userId;
return this;
}
public Builder setTriggerMode(String triggerMode) {
this.triggerMode = triggerMode; this.triggerMode = triggerMode;
return this;
}
this.countResources = false; public Builder setCountResources(boolean countResources) {
this.countResources = countResources;
return this;
}
public Builder setApiCaseIsExecuting(boolean apiCaseIsExecuting) {
this.apiCaseIsExecuting = apiCaseIsExecuting; this.apiCaseIsExecuting = apiCaseIsExecuting;
this.scenarioIsExecuting = scenarioIsExecuting; return this;
this.performanceIsExecuting = performanceIsExecuting; }
public Builder setScenarioIsExecuting(boolean scenarioIsExecuting) {
this.scenarioIsExecuting = scenarioIsExecuting;
return this;
}
public Builder setUiScenarioIsExecuting(boolean uiScenarioIsExecuting) {
this.uiScenarioIsExecuting = uiScenarioIsExecuting;
return this;
}
public Builder setPerformanceIsExecuting(boolean performanceIsExecuting) {
this.performanceIsExecuting = performanceIsExecuting;
return this;
}
public Builder setApiCaseIdMap(Map<String, String> apiCaseIdMap) {
this.apiCaseIdMap = apiCaseIdMap; this.apiCaseIdMap = apiCaseIdMap;
return this;
}
public Builder setScenarioIdMap(Map<String, String> scenarioIdMap) {
this.scenarioIdMap = scenarioIdMap; this.scenarioIdMap = scenarioIdMap;
return this;
}
public Builder setPerformanceIdMap(Map<String, String> performanceIdMap) {
this.performanceIdMap = performanceIdMap; this.performanceIdMap = performanceIdMap;
return this;
}
public Builder setUiScenarioIdMap(Map<String, String> uiScenarioIdMap) {
this.uiScenarioIdMap = uiScenarioIdMap;
return this;
}
public TestPlanReportSaveRequest build() {
return new TestPlanReportSaveRequest(this);
}
} }
} }

View File

@ -58,7 +58,7 @@ public class TestPlanMessageService {
if (testPlanReportContent != null) { if (testPlanReportContent != null) {
report = testPlanReportService.checkTestPlanReportHasErrorCase(report, testPlanReportContent); report = testPlanReportService.checkTestPlanReportHasErrorCase(report, testPlanReportContent);
} }
if (!report.getIsApiCaseExecuting() && !report.getIsPerformanceExecuting() && !report.getIsScenarioExecuting()) { if (!report.getIsApiCaseExecuting() && !report.getIsPerformanceExecuting() && !report.getIsScenarioExecuting() && !report.getIsUiScenarioExecuting()) {
//更新TestPlan状态为完成 //更新TestPlan状态为完成
TestPlanWithBLOBs testPlan = testPlanMapper.selectByPrimaryKey(report.getTestPlanId()); TestPlanWithBLOBs testPlan = testPlanMapper.selectByPrimaryKey(report.getTestPlanId());
if (testPlan != null && !StringUtils.equals(testPlan.getStatus(), TestPlanStatus.Completed.name())) { if (testPlan != null && !StringUtils.equals(testPlan.getStatus(), TestPlanStatus.Completed.name())) {

View File

@ -271,22 +271,21 @@ public class TestPlanReportService {
uiScenarioIdMap.put(dto.getId(), dto.getUiScenarioId()); uiScenarioIdMap.put(dto.getId(), dto.getUiScenarioId());
} }
Map<String, String> apiCaseInfoMap = new HashMap<>(); TestPlanReportSaveRequest saveRequest = new TestPlanReportSaveRequest.Builder()
for (String id : planTestCaseIdMap.keySet()) { .setReportID(planReportId)
apiCaseInfoMap.put(id, TestPlanApiExecuteStatus.PREPARE.name()); .setPlanId(planId)
} .setUserId(userId)
Map<String, String> scenarioInfoMap = new HashMap<>(); .setCountResources(false)
for (String id : planScenarioIdMap.keySet()) { .setTriggerMode(triggerMode)
scenarioInfoMap.put(id, TestPlanApiExecuteStatus.PREPARE.name()); .setApiCaseIsExecuting(!planTestCaseIdMap.isEmpty())
} .setScenarioIsExecuting(!planScenarioIdMap.isEmpty())
Map<String, String> performanceInfoMap = new HashMap<>(); .setPerformanceIsExecuting(!performanceIdMap.isEmpty())
for (String id : performanceIdMap.values()) { .setUiScenarioIsExecuting(!uiScenarioIdMap.isEmpty())
performanceInfoMap.put(id, TestPlanApiExecuteStatus.PREPARE.name()); .setApiCaseIdMap(planTestCaseIdMap)
} .setScenarioIdMap(planScenarioIdMap)
.setPerformanceIdMap(performanceIdMap)
TestPlanReportSaveRequest saveRequest = new TestPlanReportSaveRequest(planReportId, planId, userId, triggerMode, .setUiScenarioIdMap(uiScenarioIdMap)
planTestCaseIdMap.size() > 0, planScenarioIdMap.size() > 0, performanceIdMap.size() > 0, .build();
apiCaseInfoMap, scenarioInfoMap, performanceInfoMap);
if (testPlanReport == null) { if (testPlanReport == null) {
returnDTO = this.genTestPlanReport(saveRequest, runInfoDTO); returnDTO = this.genTestPlanReport(saveRequest, runInfoDTO);
@ -383,6 +382,9 @@ public class TestPlanReportService {
List<String> scenarioIdList = testPlanApiScenarioList.stream().map(TestPlanApiScenarioInfoDTO::getApiScenarioId).collect(Collectors.toList()); List<String> scenarioIdList = testPlanApiScenarioList.stream().map(TestPlanApiScenarioInfoDTO::getApiScenarioId).collect(Collectors.toList());
testPlanReport.setIsScenarioExecuting(!scenarioIdList.isEmpty()); testPlanReport.setIsScenarioExecuting(!scenarioIdList.isEmpty());
List<TestPlanUiScenario> testPlanUiScenarioList = extTestPlanUiScenarioCaseMapper.selectLegalDataByTestPlanId(saveRequest.getPlanId());
testPlanReport.setIsUiScenarioExecuting(!testPlanUiScenarioList.isEmpty());
LoadCaseRequest loadCaseRequest = new LoadCaseRequest(); LoadCaseRequest loadCaseRequest = new LoadCaseRequest();
loadCaseRequest.setTestPlanId(saveRequest.getPlanId()); loadCaseRequest.setTestPlanId(saveRequest.getPlanId());
loadCaseRequest.setProjectId(testPlan.getProjectId()); loadCaseRequest.setProjectId(testPlan.getProjectId());
@ -393,9 +395,13 @@ public class TestPlanReportService {
testPlanReport.setIsApiCaseExecuting(saveRequest.isApiCaseIsExecuting()); testPlanReport.setIsApiCaseExecuting(saveRequest.isApiCaseIsExecuting());
testPlanReport.setIsScenarioExecuting(saveRequest.isScenarioIsExecuting()); testPlanReport.setIsScenarioExecuting(saveRequest.isScenarioIsExecuting());
testPlanReport.setIsPerformanceExecuting(saveRequest.isPerformanceIsExecuting()); testPlanReport.setIsPerformanceExecuting(saveRequest.isPerformanceIsExecuting());
testPlanReport.setIsUiScenarioExecuting(saveRequest.isUiScenarioIsExecuting());
} }
if (testPlanReport.getIsScenarioExecuting() || testPlanReport.getIsApiCaseExecuting() || testPlanReport.getIsPerformanceExecuting()) { if (testPlanReport.getIsScenarioExecuting()
|| testPlanReport.getIsApiCaseExecuting()
|| testPlanReport.getIsPerformanceExecuting()
|| testPlanReport.getIsUiScenarioExecuting()) {
testPlanReport.setStatus(TestPlanReportStatus.RUNNING.name()); testPlanReport.setStatus(TestPlanReportStatus.RUNNING.name());
} else { } else {
testPlanReport.setStatus(TestPlanReportStatus.COMPLETED.name()); testPlanReport.setStatus(TestPlanReportStatus.COMPLETED.name());
@ -572,6 +578,7 @@ public class TestPlanReportService {
testPlanReport.setIsApiCaseExecuting(false); testPlanReport.setIsApiCaseExecuting(false);
testPlanReport.setIsScenarioExecuting(false); testPlanReport.setIsScenarioExecuting(false);
testPlanReport.setIsPerformanceExecuting(false); testPlanReport.setIsPerformanceExecuting(false);
testPlanReport.setIsUiScenarioExecuting(false);
TestPlanExecutionQueueExample testPlanExecutionQueueExample = new TestPlanExecutionQueueExample(); TestPlanExecutionQueueExample testPlanExecutionQueueExample = new TestPlanExecutionQueueExample();
testPlanExecutionQueueExample.createCriteria().andReportIdEqualTo(testPlanReportId); testPlanExecutionQueueExample.createCriteria().andReportIdEqualTo(testPlanReportId);
@ -1346,6 +1353,41 @@ public class TestPlanReportService {
LogUtil.error("Parse test plan report cenario case error!", e); LogUtil.error("Parse test plan report cenario case error!", e);
} }
} }
if (!hasErrorCase && StringUtils.isNotEmpty(content.getPlanUiScenarioReportStruct())) {
try {
List<TestPlanUiScenarioDTO> scenarioCases = JSONArray.parseArray(content.getPlanUiScenarioReportStruct(), TestPlanUiScenarioDTO.class);
List<String> reportIdList = new ArrayList<>();
scenarioCases.forEach(item -> {
if (StringUtils.isNotEmpty(item.getReportId())) {
reportIdList.add(item.getReportId());
}
});
String defaultStatus = "Fail";
Map<String, String> reportStatus = apiScenarioReportService.getReportStatusByReportIds(reportIdList);
for (TestPlanUiScenarioDTO dto : scenarioCases) {
String reportId = dto.getReportId();
if (StringUtils.isNotEmpty(reportId)) {
String execStatus = reportStatus.get(reportId);
if (execStatus == null) {
execStatus = defaultStatus;
} else {
if (StringUtils.equalsIgnoreCase(execStatus, "Error")) {
execStatus = "Fail";
}
}
dto.setLastResult(execStatus);
dto.setStatus(execStatus);
if (!StringUtils.equalsAnyIgnoreCase(execStatus, "success")) {
hasErrorCase = true;
}
}
}
} catch (Exception e) {
LogUtil.error("Parse test plan report ui scenario case error!", e);
}
}
} }
return hasErrorCase; return hasErrorCase;
} }