fix(接口自动化): 修复执行报告场景名称问题

This commit is contained in:
fit2-zhao 2021-01-18 18:12:02 +08:00
parent cb73ebc2a3
commit ba6c5b85a6
2 changed files with 9 additions and 16 deletions

View File

@ -49,8 +49,6 @@ public class ApiScenarioReportService {
private ApiScenarioMapper apiScenarioMapper; private ApiScenarioMapper apiScenarioMapper;
@Resource @Resource
private TestPlanApiScenarioMapper testPlanApiScenarioMapper; private TestPlanApiScenarioMapper testPlanApiScenarioMapper;
// @Resource
// private TestPlanReportService testPlanReportService;
public ApiScenarioReport complete(TestResult result, String runMode) { public ApiScenarioReport complete(TestResult result, String runMode) {
// 更新场景 // 更新场景
@ -144,10 +142,7 @@ public class ApiScenarioReportService {
// 报告详情内容 // 报告详情内容
ApiScenarioReportDetail detail = new ApiScenarioReportDetail(); ApiScenarioReportDetail detail = new ApiScenarioReportDetail();
TestResult newResult = createTestResult(result.getTestId(), scenarioResult); TestResult newResult = createTestResult(result.getTestId(), scenarioResult);
// List<ScenarioResult> scenarioResults = new ArrayList(); scenarioResult.setName(report.getScenarioName());
// scenarioResult.setName(report.getScenarioName());
// scenarioResults.add(scenarioResult);
// newResult.setScenarios(scenarioResults);
newResult.addScenario(scenarioResult); newResult.addScenario(scenarioResult);
detail.setContent(JSON.toJSONString(newResult).getBytes(StandardCharsets.UTF_8)); detail.setContent(JSON.toJSONString(newResult).getBytes(StandardCharsets.UTF_8));
@ -219,6 +214,7 @@ public class ApiScenarioReportService {
return lastReport; return lastReport;
} }
public ApiScenarioReport updateScenario(TestResult result) { public ApiScenarioReport updateScenario(TestResult result) {
ApiScenarioReport lastReport = null; ApiScenarioReport lastReport = null;
for (ScenarioResult item : result.getScenarios()) { for (ScenarioResult item : result.getScenarios()) {
@ -227,10 +223,7 @@ public class ApiScenarioReportService {
// 报告详情内容 // 报告详情内容
ApiScenarioReportDetail detail = new ApiScenarioReportDetail(); ApiScenarioReportDetail detail = new ApiScenarioReportDetail();
TestResult newResult = createTestResult(result.getTestId(), item); TestResult newResult = createTestResult(result.getTestId(), item);
// List<ScenarioResult> scenarioResults = new ArrayList(); item.setName(report.getScenarioName());
// item.setName(report.getScenarioName());
// scenarioResults.add(item);
// newResult.setScenarios(scenarioResults);
newResult.addScenario(item); newResult.addScenario(item);
detail.setContent(JSON.toJSONString(newResult).getBytes(StandardCharsets.UTF_8)); detail.setContent(JSON.toJSONString(newResult).getBytes(StandardCharsets.UTF_8));
detail.setReportId(report.getId()); detail.setReportId(report.getId());

View File

@ -1,5 +1,5 @@
<template> <template>
<el-dialog :title="$t('api_test.scenario.variables')" <el-dialog :title="$t('api_test.scenario.variables')" :close-on-click-modal="false"
:visible.sync="visible" class="environment-dialog" width="60%" :visible.sync="visible" class="environment-dialog" width="60%"
@close="close"> @close="close">
<div> <div>