fix(测试跟踪): 修复测试计划执行后不显示耗时的问题
--bug=1021148 --user=宋天阳 【测试跟踪】测试计划执行后不显示运行耗时 https://www.tapd.cn/55049933/s/1318385
This commit is contained in:
parent
ca40ec1332
commit
e28b8edeff
|
@ -504,9 +504,10 @@ public class TestPlanReportService {
|
|||
TestPlanReportContentWithBLOBs content = null;
|
||||
try {
|
||||
HttpHeaderUtils.runAsUser(testPlanReport.getCreator());
|
||||
testPlanReport.setStatus(status);
|
||||
content = this.initTestPlanContent(testPlanReport, status);
|
||||
boolean isRerunningTestPlan = BooleanUtils.isTrue(StringUtils.equalsIgnoreCase(testPlanReport.getStatus(), APITestStatus.Rerunning.name()));
|
||||
content = this.initTestPlanContent(testPlanReport, status, isRerunningTestPlan);
|
||||
} catch (Exception e) {
|
||||
testPlanReport.setStatus(status);
|
||||
LogUtil.error("统计测试计划状态失败!", e);
|
||||
} finally {
|
||||
HttpHeaderUtils.clearUser();
|
||||
|
@ -518,22 +519,17 @@ public class TestPlanReportService {
|
|||
return testPlanReport;
|
||||
}
|
||||
|
||||
private TestPlanReportContentWithBLOBs initTestPlanContent(TestPlanReport testPlanReport, String status) throws Exception {
|
||||
private TestPlanReportContentWithBLOBs initTestPlanContent(TestPlanReport testPlanReport, String status, boolean isRerunningTestPlan) throws Exception {
|
||||
testPlanReport.setStatus(status);
|
||||
TestPlanReportContentWithBLOBs content = null;
|
||||
//初始化测试计划包含组件信息
|
||||
int[] componentIndexArr = new int[]{1, 3, 4};
|
||||
testPlanReport.setComponents(JSON.toJSONString(componentIndexArr));
|
||||
//如果测试案例没有未结束的功能用例,则更新最后结束日期。
|
||||
TestPlanTestCaseMapper testPlanTestCaseMapper = CommonBeanFactory.getBean(TestPlanTestCaseMapper.class);
|
||||
TestPlanTestCaseExample testPlanTestCaseExample = new TestPlanTestCaseExample();
|
||||
testPlanTestCaseExample.createCriteria().andPlanIdEqualTo(testPlanReport.getTestPlanId()).andStatusNotEqualTo("Prepare");
|
||||
long endTime = System.currentTimeMillis();
|
||||
long testCaseCount = testPlanTestCaseMapper.countByExample(testPlanTestCaseExample);
|
||||
boolean updateTestPlanTime = testCaseCount > 0;
|
||||
if (updateTestPlanTime && !StringUtils.equalsAnyIgnoreCase(testPlanReport.getStatus(), APITestStatus.Rerunning.name())) {
|
||||
testPlanReport.setEndTime(endTime);
|
||||
testPlanReport.setUpdateTime(endTime);
|
||||
}
|
||||
//原逻辑中要判断包含测试计划功能用例时才会赋予结束时间。执行测试计划产生的测试报告,它的结束时间感觉没有这种判断必要。
|
||||
testPlanReport.setEndTime(endTime);
|
||||
testPlanReport.setUpdateTime(endTime);
|
||||
|
||||
TestPlanReportContentExample contentExample = new TestPlanReportContentExample();
|
||||
contentExample.createCriteria().andTestPlanReportIdEqualTo(testPlanReport.getTestPlanId());
|
||||
List<TestPlanReportContentWithBLOBs> contents = testPlanReportContentMapper.selectByExampleWithBLOBs(contentExample);
|
||||
|
@ -550,8 +546,8 @@ public class TestPlanReportService {
|
|||
testPlanService.checkStatus(testPlanReport.getTestPlanId());
|
||||
}
|
||||
if (content != null) {
|
||||
//更新content表对结束日期
|
||||
if (!StringUtils.equalsAnyIgnoreCase(testPlanReport.getStatus(), APITestStatus.Rerunning.name())) {
|
||||
//更新content表对结束日期 重跑的测试计划报告不用更新
|
||||
if (!isRerunningTestPlan) {
|
||||
content.setStartTime(testPlanReport.getStartTime());
|
||||
content.setEndTime(endTime);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue