fix(接口自动化): 用例触发模式设置及展示

This commit is contained in:
fit2-zhao 2021-04-27 16:11:13 +08:00 committed by fit2-zhao
parent 38aa2cae2f
commit 988c31be43
2 changed files with 14 additions and 9 deletions

View File

@ -123,13 +123,15 @@ public class ApiScenarioReportService {
public ApiScenarioReport editReport(ScenarioResult test, long startTime) {
ApiScenarioReport report = apiScenarioReportMapper.selectByPrimaryKey(test.getName());
report.setId(report.getId());
report.setName(report.getScenarioName() + "-" + DateUtils.getTimeStr(System.currentTimeMillis()));
report.setCreateTime(startTime);
report.setUpdateTime(startTime);
String status = test.getError() == 0 ? "Success" : "Error";
report.setStatus(status);
apiScenarioReportMapper.updateByPrimaryKeySelective(report);
if (report != null) {
report.setId(report.getId());
report.setName(report.getScenarioName() + "-" + DateUtils.getTimeStr(System.currentTimeMillis()));
report.setCreateTime(startTime);
report.setUpdateTime(startTime);
String status = test.getError() == 0 ? "Success" : "Error";
report.setStatus(status);
apiScenarioReportMapper.updateByPrimaryKeySelective(report);
}
return report;
}
@ -175,7 +177,6 @@ public class ApiScenarioReportService {
}
public ApiScenarioReport updatePlanCase(TestResult result, String runMode) {
// TestPlanApiScenario testPlanApiScenario = testPlanApiScenarioMapper.selectByPrimaryKey(result.getTestId());
List<ScenarioResult> scenarioResultList = result.getScenarios();
ApiScenarioReport returnReport = null;
StringBuilder scenarioIds = new StringBuilder();
@ -190,6 +191,9 @@ public class ApiScenarioReportService {
startTime = scenarioResult.getRequestResults().get(0).getStartTime();
}
ApiScenarioReport report = editReport(scenarioResult, startTime);
report.setTriggerMode(ReportTriggerMode.CASE.name());
apiScenarioReportMapper.updateByPrimaryKeySelective(report);
// 报告详情内容
ApiScenarioReportDetail detail = new ApiScenarioReportDetail();
TestResult newResult = createTestResult(result.getTestId(), scenarioResult);

View File

@ -118,7 +118,8 @@ export default {
triggerFilters: [
{text: this.$t('commons.trigger_mode.manual'), value: 'MANUAL'},
{text: this.$t('commons.trigger_mode.schedule'), value: 'SCHEDULE'},
{text: this.$t('commons.trigger_mode.api'), value: 'API'}
{text: this.$t('commons.trigger_mode.api'), value: 'API'},
{text: this.$t('commons.trigger_mode.case'), value: 'CASE'},
],
buttons: [
{