fix(测试计划): 执行性能测试用例失败时状态未记录
--bug=1008758 --user=lyh 【测试跟踪】手动执行测试计划,性能测试没有执行 https://www.tapd.cn/55049933/s/1081054
This commit is contained in:
parent
d37f90ba8a
commit
2841335576
|
@ -0,0 +1,5 @@
|
|||
package io.metersphere.commons.constants;
|
||||
|
||||
public enum TestPlanLoadCaseStatus {
|
||||
run, error, success
|
||||
}
|
|
@ -4,6 +4,7 @@ import io.metersphere.base.domain.LoadTestReport;
|
|||
import io.metersphere.base.mapper.ext.ExtTestPlanLoadCaseMapper;
|
||||
import io.metersphere.commons.constants.PerformanceTestStatus;
|
||||
import io.metersphere.commons.constants.ReportTriggerMode;
|
||||
import io.metersphere.commons.constants.TestPlanLoadCaseStatus;
|
||||
import io.metersphere.commons.consumer.LoadTestFinishEvent;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -24,10 +25,10 @@ public class LoadReportStatusEvent implements LoadTestFinishEvent {
|
|||
if (StringUtils.isNotBlank(reportId)) {
|
||||
String result = "";
|
||||
if (StringUtils.equals(PerformanceTestStatus.Error.name(), status)) {
|
||||
result = "error";
|
||||
result = TestPlanLoadCaseStatus.error.name();
|
||||
}
|
||||
if (StringUtils.equals(PerformanceTestStatus.Completed.name(), status)) {
|
||||
result = "success";
|
||||
result = TestPlanLoadCaseStatus.success.name();
|
||||
}
|
||||
extTestPlanLoadCaseMapper.updateCaseStatus(reportId, result);
|
||||
}
|
||||
|
|
|
@ -898,7 +898,7 @@ public class TestPlanReportService {
|
|||
if (errorDataCheckMap.get(loadTestReportId) > 10) {
|
||||
performaneReportIDList.remove(loadTestReportId);
|
||||
if (performaneReportIDMap.containsKey(loadTestReportId)) {
|
||||
finishLoadTestId.put(performaneReportIDMap.get(loadTestReportId), TestPlanApiExecuteStatus.FAILD.name());
|
||||
finishLoadTestId.put(performaneReportIDMap.get(loadTestReportId), TestPlanLoadCaseStatus.error.name());
|
||||
caseReportMap.put(performaneReportIDMap.get(loadTestReportId), loadTestReportId);
|
||||
}
|
||||
} else {
|
||||
|
@ -911,14 +911,14 @@ public class TestPlanReportService {
|
|||
testPlanLog.info("TestPlanReportId[" + testPlanReport.getId() + "] SELECT performance ID:" + loadTestReportId + ",RESULT :" + loadTestReportFromDatabase.getStatus());
|
||||
if (StringUtils.equalsAny(loadTestReportFromDatabase.getStatus(),
|
||||
PerformanceTestStatus.Completed.name(), PerformanceTestStatus.Error.name())) {
|
||||
finishLoadTestId.put(performaneReportIDMap.get(loadTestReportId), TestPlanApiExecuteStatus.SUCCESS.name());
|
||||
finishLoadTestId.put(performaneReportIDMap.get(loadTestReportId), TestPlanLoadCaseStatus.success.name());
|
||||
caseReportMap.put(performaneReportIDMap.get(loadTestReportId), loadTestReportId);
|
||||
performaneReportIDList.remove(loadTestReportId);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
performaneReportIDList.remove(loadTestReportId);
|
||||
finishLoadTestId.put(performaneReportIDMap.get(loadTestReportId), TestPlanApiExecuteStatus.FAILD.name());
|
||||
finishLoadTestId.put(performaneReportIDMap.get(loadTestReportId), TestPlanLoadCaseStatus.error.name());
|
||||
caseReportMap.put(performaneReportIDMap.get(loadTestReportId), loadTestReportId);
|
||||
testPlanLog.error(e.getMessage());
|
||||
}
|
||||
|
|
|
@ -1172,19 +1172,19 @@ public class TestPlanService {
|
|||
reportId = performanceTestService.run(performanceRequest);
|
||||
if (reportId != null) {
|
||||
performaneReportIDMap.put(reportId, id);
|
||||
TestPlanLoadCaseWithBLOBs testPlanLoadCase = new TestPlanLoadCaseWithBLOBs();
|
||||
testPlanLoadCase.setId(performanceRequest.getTestPlanLoadId());
|
||||
testPlanLoadCase.setLoadReportId(reportId);
|
||||
testPlanLoadCaseService.update(testPlanLoadCase);
|
||||
|
||||
//更新关联处的报告
|
||||
TestPlanLoadCaseWithBLOBs loadCase = new TestPlanLoadCaseDTO();
|
||||
loadCase.setId(id);
|
||||
loadCase.setLoadReportId(reportId);
|
||||
loadCase.setStatus("run");
|
||||
loadCase.setStatus(TestPlanLoadCaseStatus.run.name());
|
||||
testPlanLoadCaseService.update(loadCase);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
TestPlanLoadCaseWithBLOBs testPlanLoadCase = new TestPlanLoadCaseWithBLOBs();
|
||||
testPlanLoadCase.setId(id);
|
||||
testPlanLoadCase.setLoadReportId(reportId);
|
||||
testPlanLoadCase.setStatus(TestPlanLoadCaseStatus.error.name());
|
||||
testPlanLoadCaseService.update(testPlanLoadCase);
|
||||
LogUtil.error(e);
|
||||
}
|
||||
performaneThreadIDMap.put(performanceRequest.getTestPlanLoadId(), reportId);
|
||||
|
|
Loading…
Reference in New Issue