--bug=1007045 --user=宋天阳 【测试跟踪】执行整个测试计划,没有执行接口用例 https://www.tapd.cn/55049933/s/1059874;--bug=1007208 --user=宋天阳 【测试跟踪】测试计划手动执行完,状态还是进行中 https://www.tapd.cn/55049933/s/1059875
This commit is contained in:
parent
09db8fb607
commit
3b5f985b19
|
@ -35,4 +35,6 @@ public interface ExtTestPlanMapper {
|
||||||
List<String> findIdByPerformanceReportId(String reportId);
|
List<String> findIdByPerformanceReportId(String reportId);
|
||||||
|
|
||||||
List<TestPlan> listRecent(@Param("userId") String userId, @Param("projectId") String currentProjectId);
|
List<TestPlan> listRecent(@Param("userId") String userId, @Param("projectId") String currentProjectId);
|
||||||
|
|
||||||
|
int updateActualEndTimeIsNullById(String testPlanID);
|
||||||
}
|
}
|
||||||
|
|
|
@ -279,5 +279,9 @@
|
||||||
</where>
|
</where>
|
||||||
order by test_plan.update_time desc
|
order by test_plan.update_time desc
|
||||||
</select>
|
</select>
|
||||||
|
<update id="updateActualEndTimeIsNullById">
|
||||||
|
update test_plan
|
||||||
|
set actual_end_time = null
|
||||||
|
where id = #{0}
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
|
@ -805,8 +805,9 @@ public class TestPlanReportService {
|
||||||
//更新TestPlan状态为完成
|
//更新TestPlan状态为完成
|
||||||
TestPlanWithBLOBs testPlan = testPlanMapper.selectByPrimaryKey(report.getTestPlanId());
|
TestPlanWithBLOBs testPlan = testPlanMapper.selectByPrimaryKey(report.getTestPlanId());
|
||||||
if (testPlan != null) {
|
if (testPlan != null) {
|
||||||
|
testPlanService.checkStatus(testPlan);
|
||||||
// testPlan.setStatus(TestPlanStatus.Completed.name());
|
// testPlan.setStatus(TestPlanStatus.Completed.name());
|
||||||
testPlanMapper.updateByPrimaryKeySelective(testPlan);
|
// testPlanMapper.updateByPrimaryKeySelective(testPlan);
|
||||||
}
|
}
|
||||||
if (testPlan != null && StringUtils.equalsAny(report.getTriggerMode(),
|
if (testPlan != null && StringUtils.equalsAny(report.getTriggerMode(),
|
||||||
ReportTriggerMode.MANUAL.name(),
|
ReportTriggerMode.MANUAL.name(),
|
||||||
|
|
|
@ -509,6 +509,43 @@ public class TestPlanService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void checkStatus(TestPlanWithBLOBs testPlanWithBLOBs) { // 检查执行结果,自动更新计划状态
|
||||||
|
List<String> statusList = new ArrayList<>();
|
||||||
|
statusList.addAll(extTestPlanTestCaseMapper.getExecResultByPlanId(testPlanWithBLOBs.getId()));
|
||||||
|
statusList.addAll(testPlanApiCaseService.getExecResultByPlanId(testPlanWithBLOBs.getId()));
|
||||||
|
statusList.addAll(testPlanScenarioCaseService.getExecResultByPlanId(testPlanWithBLOBs.getId()));
|
||||||
|
statusList.addAll(testPlanLoadCaseService.getStatus(testPlanWithBLOBs.getId()));
|
||||||
|
if (statusList.size() == 0) { // 原先status不是prepare, 但删除所有关联用例的情况
|
||||||
|
testPlanWithBLOBs.setStatus(TestPlanStatus.Prepare.name());
|
||||||
|
editTestPlan(testPlanWithBLOBs);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int passNum = 0, prepareNum = 0, failNum = 0;
|
||||||
|
for (String res : statusList) {
|
||||||
|
if (StringUtils.equals(res, TestPlanTestCaseStatus.Pass.name())
|
||||||
|
|| StringUtils.equals(res, "success")
|
||||||
|
|| StringUtils.equals(res, ScenarioStatus.Success.name())) {
|
||||||
|
passNum++;
|
||||||
|
} else if (res == null || StringUtils.equals(TestPlanStatus.Prepare.name(), res)) {
|
||||||
|
prepareNum++;
|
||||||
|
} else {
|
||||||
|
failNum++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (passNum == statusList.size()) { // 全部通过
|
||||||
|
testPlanWithBLOBs.setStatus(TestPlanStatus.Completed.name());
|
||||||
|
this.editTestPlan(testPlanWithBLOBs);
|
||||||
|
// 发送成功通知
|
||||||
|
// sendCompletedNotice(testPlanWithBLOBs);
|
||||||
|
} else if (prepareNum == 0 && passNum + failNum == statusList.size()) { // 已结束
|
||||||
|
testPlanWithBLOBs.setStatus(TestPlanStatus.Finished.name());
|
||||||
|
editTestPlan(testPlanWithBLOBs);
|
||||||
|
} else if (prepareNum != 0) { // 进行中
|
||||||
|
testPlanWithBLOBs.setStatus(TestPlanStatus.Underway.name());
|
||||||
|
editTestPlan(testPlanWithBLOBs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public List<TestPlanDTOWithMetric> listTestPlanByProject(QueryTestPlanRequest request) {
|
public List<TestPlanDTOWithMetric> listTestPlanByProject(QueryTestPlanRequest request) {
|
||||||
List<TestPlanDTOWithMetric> testPlans = extTestPlanMapper.list(request);
|
List<TestPlanDTOWithMetric> testPlans = extTestPlanMapper.list(request);
|
||||||
return testPlans;
|
return testPlans;
|
||||||
|
@ -1086,6 +1123,7 @@ public class TestPlanService {
|
||||||
|
|
||||||
@Transactional(propagation = Propagation.NOT_SUPPORTED)
|
@Transactional(propagation = Propagation.NOT_SUPPORTED)
|
||||||
public String run(String testPlanID, String projectID, String userId, String triggerMode, String apiRunConfig) {
|
public String run(String testPlanID, String projectID, String userId, String triggerMode, String apiRunConfig) {
|
||||||
|
extTestPlanMapper.updateActualEndTimeIsNullById(testPlanID);
|
||||||
//创建测试报告,然后返回的ID重新赋值为resourceID,作为后续的参数
|
//创建测试报告,然后返回的ID重新赋值为resourceID,作为后续的参数
|
||||||
TestPlanScheduleReportInfoDTO reportInfoDTO = testPlanReportService.genTestPlanReportBySchedule(projectID, testPlanID, userId, triggerMode);
|
TestPlanScheduleReportInfoDTO reportInfoDTO = testPlanReportService.genTestPlanReportBySchedule(projectID, testPlanID, userId, triggerMode);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue