fix(接口自动化): 修改执行步骤为 生成报告,自动生成测试报告。

This commit is contained in:
fit2-zhao 2021-06-30 15:02:20 +08:00 committed by fit2-zhao
parent 01cbbc99df
commit 69013f62ed
8 changed files with 16 additions and 6 deletions

View File

@ -160,6 +160,9 @@ public class ApiAutomationController {
public void runDebug(@RequestPart("request") RunDefinitionRequest request, public void runDebug(@RequestPart("request") RunDefinitionRequest request,
@RequestPart(value = "bodyFiles", required = false) List<MultipartFile> bodyFiles, @RequestPart(value = "scenarioFiles", required = false) List<MultipartFile> scenarioFiles) { @RequestPart(value = "bodyFiles", required = false) List<MultipartFile> bodyFiles, @RequestPart(value = "scenarioFiles", required = false) List<MultipartFile> scenarioFiles) {
request.setExecuteType(ExecuteType.Debug.name()); request.setExecuteType(ExecuteType.Debug.name());
if (request.isSaved()) {
request.setExecuteType(ExecuteType.Saved.name());
}
apiAutomationService.debugRun(request, bodyFiles, scenarioFiles); apiAutomationService.debugRun(request, bodyFiles, scenarioFiles);
} }
@ -245,6 +248,7 @@ public class ApiAutomationController {
public List<JmxInfoDTO> batchGenPerformanceTestJmx(@RequestBody ApiScenarioBatchRequest request) { public List<JmxInfoDTO> batchGenPerformanceTestJmx(@RequestBody ApiScenarioBatchRequest request) {
return apiAutomationService.batchGenPerformanceTestJmx(request); return apiAutomationService.batchGenPerformanceTestJmx(request);
} }
@PostMapping("/batchCopy") @PostMapping("/batchCopy")
public void batchCopy(@RequestBody ApiScenarioBatchRequest request) { public void batchCopy(@RequestBody ApiScenarioBatchRequest request) {
apiAutomationService.batchCopy(request); apiAutomationService.batchCopy(request);

View File

@ -17,6 +17,8 @@ public class RunDefinitionRequest {
private String reportId; private String reportId;
private boolean saved;
private String requestId; private String requestId;
private String name; private String name;

View File

@ -14,6 +14,7 @@ import {saveScenario} from "@/business/components/api/automation/api-automation"
debug: Boolean, debug: Boolean,
reportId: String, reportId: String,
runData: Object, runData: Object,
saved: Boolean,
}, },
data() { data() {
return { return {
@ -42,7 +43,7 @@ import {saveScenario} from "@/business/components/api/automation/api-automation"
this.runData.projectId = getCurrentProjectID(); this.runData.projectId = getCurrentProjectID();
threadGroup.hashTree.push(this.runData); threadGroup.hashTree.push(this.runData);
testPlan.hashTree.push(threadGroup); testPlan.hashTree.push(threadGroup);
let reqObj = {id: this.reportId, reportId: this.reportId, scenarioName: this.runData.name, let reqObj = {id: this.reportId, reportId: this.reportId, scenarioName: this.runData.name,saved:this.saved,
scenarioId: this.runData.id, testElement: testPlan, projectId: getCurrentProjectID(), environmentMap: strMapToObj(map)}; scenarioId: this.runData.id, testElement: testPlan, projectId: getCurrentProjectID(), environmentMap: strMapToObj(map)};
saveScenario('/api/automation/run/debug', reqObj, this.runData.hashTree, (response) => { saveScenario('/api/automation/run/debug', reqObj, this.runData.hashTree, (response) => {
this.runId = response.data; this.runId = response.data;

View File

@ -146,7 +146,7 @@
<el-dropdown split-button type="primary" @click="runDebug" class="ms-message-right" size="mini" @command="handleCommand" v-if="!debugLoading"> <el-dropdown split-button type="primary" @click="runDebug" class="ms-message-right" size="mini" @command="handleCommand" v-if="!debugLoading">
{{ $t('api_test.request.debug') }} {{ $t('api_test.request.debug') }}
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item>{{ $t('test_track.case.steps') }}</el-dropdown-item> <el-dropdown-item>{{ $t('api_test.automation.generate_report') }}</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
<el-button icon="el-icon-loading" size="mini" type="primary" :disabled="debug" v-else>执行中</el-button> <el-button icon="el-icon-loading" size="mini" type="primary" :disabled="debug" v-else>执行中</el-button>
@ -235,13 +235,13 @@
<api-environment-config v-if="type!=='detail'" ref="environmentConfig" @close="environmentConfigClose"/> <api-environment-config v-if="type!=='detail'" ref="environmentConfig" @close="environmentConfigClose"/>
<!--执行组件--> <!--执行组件-->
<ms-run :debug="true" v-if="type!=='detail'" :environment="projectEnvMap" :reportId="reportId" <ms-run :debug="true" v-if="type!=='detail'" :environment="projectEnvMap" :reportId="reportId" :saved="!debug"
:run-data="debugData" :run-data="debugData"
@runRefresh="runRefresh" ref="runTest"/> @runRefresh="runRefresh" ref="runTest"/>
<!-- 调试结果 --> <!-- 调试结果 -->
<el-drawer v-if="type!=='detail'" :visible.sync="debugVisible" :destroy-on-close="true" direction="ltr" <el-drawer v-if="type!=='detail'" :visible.sync="debugVisible" :destroy-on-close="true" direction="ltr"
:withHeader="true" :modal="false" size="90%"> :withHeader="true" :modal="false" size="90%">
<ms-api-report-detail :report-id="reportId" :debug="debug" :currentProjectId="projectId" @refresh="detailRefresh"/> <ms-api-report-detail :report-id="reportId" :debug="true" :currentProjectId="projectId" @refresh="detailRefresh"/>
</el-drawer> </el-drawer>
<!--场景公共参数--> <!--场景公共参数-->

View File

@ -19,7 +19,7 @@
</div> </div>
<div class="ms-header-right"> <div class="ms-header-right">
<el-checkbox v-model="cookieShare" @change="setCookieShare">共享cookie</el-checkbox> <el-checkbox v-model="cookieShare" @change="setCookieShare">共享cookie</el-checkbox>
<el-checkbox v-model="sampleError" @change="setOnSampleError" style="margin-right: 10px">失败继续</el-checkbox> <el-checkbox v-model="sampleError" @change="setOnSampleError" style="margin-right: 10px">{{$t('commons.failure_continues')}}</el-checkbox>
<env-popover :disabled="scenarioDefinition.length < 1" :isReadOnly="scenarioDefinition.length < 1" <env-popover :disabled="scenarioDefinition.length < 1" :isReadOnly="scenarioDefinition.length < 1"
:env-map="envMap" :project-ids="projectIds" @setProjectEnvMap="setProjectEnvMap" :env-map="envMap" :project-ids="projectIds" @setProjectEnvMap="setProjectEnvMap"
@showPopover="showPopover" :project-list="projectList" ref="envPopover" class="ms-right" @showPopover="showPopover" :project-list="projectList" ref="envPopover" class="ms-right"
@ -28,7 +28,7 @@
<el-dropdown split-button type="primary" @click="runDebug" style="margin-right: 10px" size="mini" @command="handleCommand" v-if="!debug"> <el-dropdown split-button type="primary" @click="runDebug" style="margin-right: 10px" size="mini" @command="handleCommand" v-if="!debug">
{{ $t('api_test.request.debug') }} {{ $t('api_test.request.debug') }}
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item>{{ $t('test_track.case.steps') }}</el-dropdown-item> <el-dropdown-item>{{ $t('api_test.automation.generate_report') }}</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
<el-button icon="el-icon-loading" size="mini" type="primary" :disabled="debug" v-else>执行中</el-button> <el-button icon="el-icon-loading" size="mini" type="primary" :disabled="debug" v-else>执行中</el-button>

View File

@ -930,6 +930,7 @@ export default {
request_total: "request", request_total: "request",
request_success: "success", request_success: "success",
request_error: "error", request_error: "error",
generate_report: "Generate report",
}, },
environment: { environment: {
create: 'Create environment', create: 'Create environment',

View File

@ -929,6 +929,7 @@ export default {
request_total: "请求", request_total: "请求",
request_success: "成功", request_success: "成功",
request_error: "失败", request_error: "失败",
generate_report: "生成报告",
}, },
environment: { environment: {
create: '创建环境', create: '创建环境',

View File

@ -930,6 +930,7 @@ export default {
request_total: "請求", request_total: "請求",
request_success: "成功", request_success: "成功",
request_error: "失敗", request_error: "失敗",
generate_report: "生成報告",
}, },
environment: { environment: {
create: '創建環境', create: '創建環境',