feat(接口自动化): 报告优化
This commit is contained in:
parent
e451248e25
commit
86b19b68fc
|
@ -40,20 +40,26 @@ public class TestResult {
|
|||
this.passAssertions += count;
|
||||
}
|
||||
|
||||
private static final String separator = "<->";
|
||||
|
||||
public void addScenario(ScenarioResult result) {
|
||||
Map<String, List<RequestResult>> requestResultMap = new LinkedHashMap<>();
|
||||
if (result != null && CollectionUtils.isNotEmpty(result.getRequestResults())) {
|
||||
result.getRequestResults().forEach(item -> {
|
||||
if (StringUtils.isNotEmpty(item.getName()) && item.getName().indexOf("<->") != -1) {
|
||||
String array[] = item.getName().split("<->");
|
||||
item.setName(array[0]);
|
||||
if (requestResultMap.containsKey(array[1])) {
|
||||
requestResultMap.get(array[1]).add(item);
|
||||
if (StringUtils.isNotEmpty(item.getName()) && item.getName().indexOf(separator) != -1) {
|
||||
String array[] = item.getName().split(separator);
|
||||
String scenarioName = array[array.length - 1];
|
||||
item.setName(item.getName().replace(separator + scenarioName, ""));
|
||||
if (requestResultMap.containsKey(scenarioName)) {
|
||||
requestResultMap.get(scenarioName).add(item);
|
||||
} else {
|
||||
List<RequestResult> requestResults = new LinkedList<>();
|
||||
requestResults.add(item);
|
||||
requestResultMap.put(array[1], requestResults);
|
||||
requestResultMap.put(scenarioName, requestResults);
|
||||
}
|
||||
item.getSubRequestResults().forEach(subItem -> {
|
||||
subItem.setName(item.getName());
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -441,6 +441,7 @@ public class ApiAutomationService {
|
|||
ParameterConfig config = new ParameterConfig();
|
||||
config.setConfig(envConfig);
|
||||
HashTree hashTree = request.getTestElement().generateHashTree(config);
|
||||
|
||||
// 调用执行方法
|
||||
createScenarioReport(request.getId(), request.getScenarioId(), request.getScenarioName(), ReportTriggerMode.MANUAL.name(), request.getExecuteType(), request.getProjectId(),
|
||||
SessionUtils.getUserId());
|
||||
|
|
|
@ -9,14 +9,21 @@
|
|||
<main v-if="this.isNotRunning">
|
||||
<ms-metric-chart :content="content" :totalTime="totalTime"/>
|
||||
<div>
|
||||
<!--<ms-scenario-results :scenarios="content.scenarios" v-on:requestResult="requestResult"/>-->
|
||||
|
||||
<el-tabs v-model="activeName" @tab-click="handleClick">
|
||||
<el-tab-pane :label="$t('api_report.total')" name="total">
|
||||
<ms-scenario-results :scenarios="content.scenarios" v-on:requestResult="requestResult"/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane name="fail">
|
||||
<template slot="label">
|
||||
<span class="fail">{{ $t('api_report.fail') }}</span>
|
||||
</template>
|
||||
<ms-scenario-results v-on:requestResult="requestResult" :scenarios="fails"/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
||||
</div>
|
||||
<!--<el-collapse-transition>-->
|
||||
<!--<div v-show="isActive" style="width: 99%">-->
|
||||
<!--<ms-request-result-tail v-if="isRequestResult" :request-type="requestType" :request="request"-->
|
||||
<!--:scenario-name="scenarioName"/>-->
|
||||
<!--</div>-->
|
||||
<!--</el-collapse-transition>-->
|
||||
<ms-api-report-export v-if="reportExportVisible" id="apiTestReport" :title="report.testName"
|
||||
:content="content" :total-time="totalTime"/>
|
||||
</main>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<div class="scenario-result">
|
||||
<div class="scenario-result" v-if="scenario && scenario.requestResults && scenario.requestResults.length>0">
|
||||
|
||||
<div @click="active">
|
||||
<el-row :gutter="10" type="flex" align="middle" class="info">
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<div style="min-width: 1200px;margin-bottom: 20px">
|
||||
<div style="margin-bottom: 20px">
|
||||
<span class="kv-description" v-if="description">
|
||||
{{ description }}
|
||||
</span>
|
||||
|
|
|
@ -28,18 +28,15 @@
|
|||
<el-row v-if="body.type == 'Form Data' || body.type == 'WWW_FORM'">
|
||||
<el-link class="ms-el-link" @click="batchAdd"> {{$t("commons.batch_add")}}</el-link>
|
||||
</el-row>
|
||||
|
||||
<div style="min-width: 1200px;" v-if="body.type == 'Form Data' || body.type == 'WWW_FORM'">
|
||||
<ms-api-variable :is-read-only="isReadOnly"
|
||||
:parameters="body.kvs"
|
||||
:isShowEnable="isShowEnable"
|
||||
type="body"
|
||||
v-if="body.type == 'Form Data'"/>
|
||||
:isShowEnable="isShowEnable" type="body" v-if="body.type == 'Form Data'"/>
|
||||
|
||||
<ms-api-from-url-variable :is-read-only="isReadOnly"
|
||||
:parameters="body.kvs"
|
||||
type="body"
|
||||
v-if="body.type == 'WWW_FORM'"/>
|
||||
|
||||
type="body" v-if="body.type == 'WWW_FORM'"/>
|
||||
</div>
|
||||
<div v-if="body.type == 'JSON'">
|
||||
<div style="padding: 10px">
|
||||
<el-switch active-text="JSON-SCHEMA" v-model="body.format" active-value="JSON-SCHEMA"/>
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
<el-tabs v-model="activeName" @tab-click="handleClick">
|
||||
<el-tab-pane :label="$t('organization.message.template')" name="apiTemplate">
|
||||
<el-button type="primary" size="mini" style="margin-left: 10px" @click="openOneClickOperation">导入</el-button>
|
||||
<div style="min-height: 400px">
|
||||
<div style="min-height: 200px">
|
||||
<json-schema-editor class="schema" :value="schema" lang="zh_CN" custom/>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="$t('schema.preview')" name="preview">
|
||||
<div style="min-height: 400px">
|
||||
<div style="min-height: 200px">
|
||||
<pre>{{this.preview}}</pre>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
|
|
Loading…
Reference in New Issue