Merge branch 'master' of https://github.com/metersphere/metersphere
This commit is contained in:
commit
c964785385
|
@ -61,8 +61,11 @@ public class MsLoopController extends MsTestElement {
|
||||||
loopController.setName(this.getLabel());
|
loopController.setName(this.getLabel());
|
||||||
loopController.setProperty(TestElement.TEST_CLASS, LoopController.class.getName());
|
loopController.setProperty(TestElement.TEST_CLASS, LoopController.class.getName());
|
||||||
loopController.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("LoopControlPanel"));
|
loopController.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("LoopControlPanel"));
|
||||||
// loopController.setContinueForever(countController.isProceed());
|
|
||||||
loopController.setLoops(countController.getLoops());
|
loopController.setLoops(countController.getLoops());
|
||||||
|
// 不打开执行成功后轮询功能,则成功后就停止循环
|
||||||
|
if (!countController.isProceed()) {
|
||||||
|
|
||||||
|
}
|
||||||
return loopController;
|
return loopController;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -363,12 +363,14 @@ public class ApiAutomationService {
|
||||||
// 多态JSON普通转换会丢失内容,需要通过 ObjectMapper 获取
|
// 多态JSON普通转换会丢失内容,需要通过 ObjectMapper 获取
|
||||||
if (element != null && StringUtils.isNotEmpty(element.getString("hashTree"))) {
|
if (element != null && StringUtils.isNotEmpty(element.getString("hashTree"))) {
|
||||||
LinkedList<MsTestElement> elements = mapper.readValue(element.getString("hashTree"),
|
LinkedList<MsTestElement> elements = mapper.readValue(element.getString("hashTree"),
|
||||||
new TypeReference<LinkedList<MsTestElement>>() {});
|
new TypeReference<LinkedList<MsTestElement>>() {
|
||||||
|
});
|
||||||
scenario.setHashTree(elements);
|
scenario.setHashTree(elements);
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotEmpty(element.getString("variables"))) {
|
if (StringUtils.isNotEmpty(element.getString("variables"))) {
|
||||||
LinkedList<ScenarioVariable> variables = mapper.readValue(element.getString("variables"),
|
LinkedList<ScenarioVariable> variables = mapper.readValue(element.getString("variables"),
|
||||||
new TypeReference<LinkedList<ScenarioVariable>>() {});
|
new TypeReference<LinkedList<ScenarioVariable>>() {
|
||||||
|
});
|
||||||
scenario.setVariables(variables);
|
scenario.setVariables(variables);
|
||||||
}
|
}
|
||||||
group.setEnableCookieShare(scenario.isEnableCookieShare());
|
group.setEnableCookieShare(scenario.isEnableCookieShare());
|
||||||
|
@ -397,14 +399,12 @@ public class ApiAutomationService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String run(RunScenarioRequest request) {
|
public String run(RunScenarioRequest request) {
|
||||||
List<ApiScenarioWithBLOBs> apiScenarios = null;
|
|
||||||
List<String> ids = request.getScenarioIds();
|
List<String> ids = request.getScenarioIds();
|
||||||
if (request.isSelectAllDate()) {
|
if (request.isSelectAllDate()) {
|
||||||
ids = this.getAllScenarioIdsByFontedSelect(
|
ids = this.getAllScenarioIdsByFontedSelect(
|
||||||
request.getModuleIds(), request.getName(), request.getProjectId(), request.getFilters(), request.getUnSelectIds());
|
request.getModuleIds(), request.getName(), request.getProjectId(), request.getFilters(), request.getUnSelectIds());
|
||||||
}
|
}
|
||||||
apiScenarios = extApiScenarioMapper.selectIds(ids);
|
List<ApiScenarioWithBLOBs> apiScenarios = extApiScenarioMapper.selectIds(ids);
|
||||||
|
|
||||||
String runMode = ApiRunMode.SCENARIO.name();
|
String runMode = ApiRunMode.SCENARIO.name();
|
||||||
if (StringUtils.isNotBlank(request.getRunMode()) && StringUtils.equals(request.getRunMode(), ApiRunMode.SCENARIO_PLAN.name())) {
|
if (StringUtils.isNotBlank(request.getRunMode()) && StringUtils.equals(request.getRunMode(), ApiRunMode.SCENARIO_PLAN.name())) {
|
||||||
runMode = ApiRunMode.SCENARIO_PLAN.name();
|
runMode = ApiRunMode.SCENARIO_PLAN.name();
|
||||||
|
@ -427,17 +427,17 @@ public class ApiAutomationService {
|
||||||
MsTestPlan testPlan = new MsTestPlan();
|
MsTestPlan testPlan = new MsTestPlan();
|
||||||
testPlan.setHashTree(new LinkedList<>());
|
testPlan.setHashTree(new LinkedList<>());
|
||||||
HashTree jmeterHashTree = new ListedHashTree();
|
HashTree jmeterHashTree = new ListedHashTree();
|
||||||
Map<String, Map<String,String>> testPlanScenarioIdMap = request.getTestPlanScenarioIDMap();
|
Map<String, Map<String, String>> testPlanScenarioIdMap = request.getTestPlanScenarioIDMap();
|
||||||
for (Map.Entry<String, Map<String,String>> entry : testPlanScenarioIdMap.entrySet()) {
|
for (Map.Entry<String, Map<String, String>> entry : testPlanScenarioIdMap.entrySet()) {
|
||||||
String testPlanID = entry.getKey();
|
String testPlanID = entry.getKey();
|
||||||
Map<String,String> planScenarioIdMap = entry.getValue();
|
Map<String, String> planScenarioIdMap = entry.getValue();
|
||||||
List<ApiScenarioWithBLOBs> apiScenarios = extApiScenarioMapper.selectIds(new ArrayList<>(planScenarioIdMap.keySet()));
|
List<ApiScenarioWithBLOBs> apiScenarios = extApiScenarioMapper.selectIds(new ArrayList<>(planScenarioIdMap.keySet()));
|
||||||
try {
|
try {
|
||||||
boolean isFirst = true;
|
boolean isFirst = true;
|
||||||
for (ApiScenarioWithBLOBs item : apiScenarios) {
|
for (ApiScenarioWithBLOBs item : apiScenarios) {
|
||||||
String apiScenarioID = item.getId();
|
String apiScenarioID = item.getId();
|
||||||
String planScenarioID = planScenarioIdMap.get(apiScenarioID);
|
String planScenarioID = planScenarioIdMap.get(apiScenarioID);
|
||||||
if(StringUtils.isEmpty(planScenarioID)){
|
if (StringUtils.isEmpty(planScenarioID)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (item.getStepTotal() == 0) {
|
if (item.getStepTotal() == 0) {
|
||||||
|
@ -480,7 +480,7 @@ public class ApiAutomationService {
|
||||||
// 创建场景报告
|
// 创建场景报告
|
||||||
//不同的运行模式,第二个参数入参不同
|
//不同的运行模式,第二个参数入参不同
|
||||||
createScenarioReport(group.getName(),
|
createScenarioReport(group.getName(),
|
||||||
planScenarioID+":"+request.getTestPlanReportId() ,
|
planScenarioID + ":" + request.getTestPlanReportId(),
|
||||||
item.getName(), request.getTriggerMode() == null ? ReportTriggerMode.MANUAL.name() : request.getTriggerMode(),
|
item.getName(), request.getTriggerMode() == null ? ReportTriggerMode.MANUAL.name() : request.getTriggerMode(),
|
||||||
request.getExecuteType(), item.getProjectId(), request.getReportUserID());
|
request.getExecuteType(), item.getProjectId(), request.getReportUserID());
|
||||||
group.setHashTree(scenarios);
|
group.setHashTree(scenarios);
|
||||||
|
|
|
@ -85,6 +85,8 @@
|
||||||
<ms-request-result-tail :response="responseData"/>
|
<ms-request-result-tail :response="responseData"/>
|
||||||
</div>
|
</div>
|
||||||
</el-collapse-transition>
|
</el-collapse-transition>
|
||||||
|
|
||||||
|
<ms-jmx-step :request="apiCase.request"/>
|
||||||
<!-- 保存操作 -->
|
<!-- 保存操作 -->
|
||||||
<el-button type="primary" size="small" style="margin: 20px; float: right" @click="saveTestCase(apiCase)" v-tester>
|
<el-button type="primary" size="small" style="margin: 20px; float: right" @click="saveTestCase(apiCase)" v-tester>
|
||||||
{{ $t('commons.save') }}
|
{{ $t('commons.save') }}
|
||||||
|
@ -108,6 +110,7 @@
|
||||||
import MsApiExtendBtns from "../reference/ApiExtendBtns";
|
import MsApiExtendBtns from "../reference/ApiExtendBtns";
|
||||||
import MsInputTag from "@/business/components/api/automation/scenario/MsInputTag";
|
import MsInputTag from "@/business/components/api/automation/scenario/MsInputTag";
|
||||||
import MsRequestResultTail from "../response/RequestResultTail";
|
import MsRequestResultTail from "../response/RequestResultTail";
|
||||||
|
import MsJmxStep from "../step/JmxStep";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ApiCaseItem",
|
name: "ApiCaseItem",
|
||||||
|
@ -122,7 +125,8 @@
|
||||||
MsTcpBasisParameters,
|
MsTcpBasisParameters,
|
||||||
MsDubboBasisParameters,
|
MsDubboBasisParameters,
|
||||||
MsApiExtendBtns,
|
MsApiExtendBtns,
|
||||||
MsRequestResultTail
|
MsRequestResultTail,
|
||||||
|
MsJmxStep
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -312,14 +316,6 @@
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.is-active {
|
|
||||||
transform: rotate(90deg);
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon.is-responseActive {
|
|
||||||
transform: rotate(90deg);
|
|
||||||
}
|
|
||||||
|
|
||||||
.tip {
|
.tip {
|
||||||
padding: 3px 5px;
|
padding: 3px 5px;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
|
|
|
@ -11,14 +11,15 @@
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
|
|
||||||
<p class="tip">{{$t('api_test.definition.request.req_param')}} </p>
|
<p class="tip">{{$t('api_test.definition.request.req_param')}} </p>
|
||||||
<!-- TCP 请求参数 -->
|
<!-- 请求参数 -->
|
||||||
<ms-basis-parameters :request="request" ref="requestForm"/>
|
<ms-basis-parameters :request="request" ref="requestForm"/>
|
||||||
|
|
||||||
|
|
||||||
<!-- TCP 请求返回数据 -->
|
<!-- 请求返回数据 -->
|
||||||
<p class="tip">{{$t('api_test.definition.request.res_param')}} </p>
|
<p class="tip">{{$t('api_test.definition.request.res_param')}} </p>
|
||||||
<ms-request-result-tail :response="responseData" :currentProtocol="currentProtocol" ref="debugResult"/>
|
<ms-request-result-tail :response="responseData" :currentProtocol="currentProtocol" ref="debugResult"/>
|
||||||
|
|
||||||
|
<ms-jmx-step :request="request" :response="responseData"/>
|
||||||
<!-- 执行组件 -->
|
<!-- 执行组件 -->
|
||||||
<ms-run :debug="true" :reportId="reportId" :run-data="runData" @runRefresh="runRefresh" ref="runTest"/>
|
<ms-run :debug="true" :reportId="reportId" :run-data="runData" @runRefresh="runRefresh" ref="runTest"/>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
@ -38,10 +39,11 @@
|
||||||
import {REQ_METHOD} from "../../model/JsonData";
|
import {REQ_METHOD} from "../../model/JsonData";
|
||||||
import MsRequestResultTail from "../response/RequestResultTail";
|
import MsRequestResultTail from "../response/RequestResultTail";
|
||||||
import MsBasisParameters from "../request/dubbo/BasisParameters";
|
import MsBasisParameters from "../request/dubbo/BasisParameters";
|
||||||
|
import MsJmxStep from "../step/JmxStep";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ApiConfig",
|
name: "ApiConfig",
|
||||||
components: {MsRequestResultTail, MsResponseResult, MsRequestMetric, MsResponseText, MsRun, MsBasisParameters},
|
components: {MsRequestResultTail, MsResponseResult, MsRequestMetric, MsResponseText, MsRun, MsBasisParameters,MsJmxStep},
|
||||||
props: {
|
props: {
|
||||||
currentProtocol: String,
|
currentProtocol: String,
|
||||||
scenario: Boolean,
|
scenario: Boolean,
|
||||||
|
|
|
@ -27,12 +27,13 @@
|
||||||
<p class="tip">{{$t('api_test.definition.request.req_param')}} </p>
|
<p class="tip">{{$t('api_test.definition.request.req_param')}} </p>
|
||||||
<!-- HTTP 请求参数 -->
|
<!-- HTTP 请求参数 -->
|
||||||
<ms-api-request-form :headers="request.headers" :request="request" :response="responseData"/>
|
<ms-api-request-form :headers="request.headers" :request="request" :response="responseData"/>
|
||||||
|
|
||||||
</el-form>
|
</el-form>
|
||||||
<!-- HTTP 请求返回数据 -->
|
<!-- HTTP 请求返回数据 -->
|
||||||
<p class="tip">{{$t('api_test.definition.request.res_param')}} </p>
|
<p class="tip">{{$t('api_test.definition.request.res_param')}} </p>
|
||||||
<ms-request-result-tail :response="responseData" ref="debugResult"/>
|
<ms-request-result-tail :response="responseData" ref="debugResult"/>
|
||||||
|
|
||||||
|
<ms-jmx-step :request="request" :response="responseData"/>
|
||||||
|
|
||||||
<!-- 执行组件 -->
|
<!-- 执行组件 -->
|
||||||
<ms-run :debug="true" :reportId="reportId" :run-data="runData" @runRefresh="runRefresh" ref="runTest"/>
|
<ms-run :debug="true" :reportId="reportId" :run-data="runData" @runRefresh="runRefresh" ref="runTest"/>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
@ -53,10 +54,11 @@
|
||||||
import {createComponent} from "../jmeter/components";
|
import {createComponent} from "../jmeter/components";
|
||||||
import {REQ_METHOD} from "../../model/JsonData";
|
import {REQ_METHOD} from "../../model/JsonData";
|
||||||
import MsRequestResultTail from "../response/RequestResultTail";
|
import MsRequestResultTail from "../response/RequestResultTail";
|
||||||
|
import MsJmxStep from "../step/JmxStep";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ApiConfig",
|
name: "ApiConfig",
|
||||||
components: {MsRequestResultTail, MsResponseResult, MsApiRequestForm, MsRequestMetric, MsResponseText, MsRun},
|
components: {MsRequestResultTail, MsResponseResult, MsApiRequestForm, MsRequestMetric, MsResponseText, MsRun,MsJmxStep},
|
||||||
props: {
|
props: {
|
||||||
currentProtocol: String,
|
currentProtocol: String,
|
||||||
testCase: {},
|
testCase: {},
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
<p class="tip">{{$t('api_test.definition.request.res_param')}} </p>
|
<p class="tip">{{$t('api_test.definition.request.res_param')}} </p>
|
||||||
<ms-request-result-tail :response="responseData" :currentProtocol="currentProtocol" ref="debugResult"/>
|
<ms-request-result-tail :response="responseData" :currentProtocol="currentProtocol" ref="debugResult"/>
|
||||||
|
|
||||||
|
<ms-jmx-step :request="request" :response="responseData"/>
|
||||||
|
|
||||||
<!-- 执行组件 -->
|
<!-- 执行组件 -->
|
||||||
<ms-run :debug="true" :reportId="reportId" :run-data="runData" @runRefresh="runRefresh" ref="runTest"/>
|
<ms-run :debug="true" :reportId="reportId" :run-data="runData" @runRefresh="runRefresh" ref="runTest"/>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
@ -40,10 +42,11 @@
|
||||||
import {REQ_METHOD} from "../../model/JsonData";
|
import {REQ_METHOD} from "../../model/JsonData";
|
||||||
import MsRequestResultTail from "../response/RequestResultTail";
|
import MsRequestResultTail from "../response/RequestResultTail";
|
||||||
import MsBasisParameters from "../request/database/BasisParameters";
|
import MsBasisParameters from "../request/database/BasisParameters";
|
||||||
|
import MsJmxStep from "../step/JmxStep";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ApiConfig",
|
name: "ApiConfig",
|
||||||
components: {MsRequestResultTail, MsResponseResult, MsRequestMetric, MsResponseText, MsRun, MsBasisParameters},
|
components: {MsRequestResultTail, MsResponseResult, MsRequestMetric, MsResponseText, MsRun, MsBasisParameters, MsJmxStep},
|
||||||
props: {
|
props: {
|
||||||
currentProtocol: String,
|
currentProtocol: String,
|
||||||
scenario: Boolean,
|
scenario: Boolean,
|
||||||
|
|
|
@ -63,24 +63,24 @@
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="showScript">
|
<!--<div v-if="showScript">-->
|
||||||
<div v-for="row in request.hashTree" :key="row.id" v-loading="isReloadData" style="margin-left: 20px;width: 100%">
|
<!--<div v-for="row in request.hashTree" :key="row.id" v-loading="isReloadData" style="margin-left: 20px;width: 100%">-->
|
||||||
<!-- 前置脚本 -->
|
<!--<!– 前置脚本 –>-->
|
||||||
<ms-jsr233-processor v-if="row.label ==='JSR223 PreProcessor'" @copyRow="copyRow" @remove="remove" :is-read-only="false" :title="$t('api_test.definition.request.pre_script')" style-type="color: #B8741A;background-color: #F9F1EA"
|
<!--<ms-jsr233-processor v-if="row.label ==='JSR223 PreProcessor'" @copyRow="copyRow" @remove="remove" :is-read-only="false" :title="$t('api_test.definition.request.pre_script')" style-type="color: #B8741A;background-color: #F9F1EA"-->
|
||||||
:jsr223-processor="row"/>
|
<!--:jsr223-processor="row"/>-->
|
||||||
<!--后置脚本-->
|
<!--<!–后置脚本–>-->
|
||||||
<ms-jsr233-processor v-if="row.label ==='JSR223 PostProcessor'" @copyRow="copyRow" @remove="remove" :is-read-only="false" :title="$t('api_test.definition.request.post_script')" style-type="color: #783887;background-color: #F2ECF3"
|
<!--<ms-jsr233-processor v-if="row.label ==='JSR223 PostProcessor'" @copyRow="copyRow" @remove="remove" :is-read-only="false" :title="$t('api_test.definition.request.post_script')" style-type="color: #783887;background-color: #F2ECF3"-->
|
||||||
:jsr223-processor="row"/>
|
<!--:jsr223-processor="row"/>-->
|
||||||
<!--断言规则-->
|
<!--<!–断言规则–>-->
|
||||||
<div style="margin-top: 10px">
|
<!--<div style="margin-top: 10px">-->
|
||||||
<ms-api-assertions v-if="row.type==='Assertions'" @copyRow="copyRow" @remove="remove" :is-read-only="isReadOnly" :assertions="row"/>
|
<!--<ms-api-assertions v-if="row.type==='Assertions'" @copyRow="copyRow" @remove="remove" :is-read-only="isReadOnly" :assertions="row"/>-->
|
||||||
</div>
|
<!--</div>-->
|
||||||
<!--提取规则-->
|
<!--<!–提取规则–>-->
|
||||||
<div style="margin-top: 10px">
|
<!--<div style="margin-top: 10px">-->
|
||||||
<ms-api-extract :is-read-only="isReadOnly" @copyRow="copyRow" @remove="remove" v-if="row.type==='Extract'" :extract="row"/>
|
<!--<ms-api-extract :is-read-only="isReadOnly" @copyRow="copyRow" @remove="remove" v-if="row.type==='Extract'" :extract="row"/>-->
|
||||||
</div>
|
<!--</div>-->
|
||||||
</div>
|
<!--</div>-->
|
||||||
</div>
|
<!--</div>-->
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="3" class="ms-left-cell" v-if="showScript">
|
<el-col :span="3" class="ms-left-cell" v-if="showScript">
|
||||||
|
|
||||||
|
|
|
@ -41,24 +41,24 @@
|
||||||
|
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="showScript">
|
<!--<div v-if="showScript">-->
|
||||||
<div v-for="row in request.hashTree" :key="row.id" v-loading="isReloadData" style="margin-left: 20px;width: 100%">
|
<!--<div v-for="row in request.hashTree" :key="row.id" v-loading="isReloadData" style="margin-left: 20px;width: 100%">-->
|
||||||
<!-- 前置脚本 -->
|
<!--<!– 前置脚本 –>-->
|
||||||
<ms-jsr233-processor v-if="row.label ==='JSR223 PreProcessor'" @copyRow="copyRow" @remove="remove" :is-read-only="false" :title="$t('api_test.definition.request.pre_script')" style-type="color: #B8741A;background-color: #F9F1EA"
|
<!--<ms-jsr233-processor v-if="row.label ==='JSR223 PreProcessor'" @copyRow="copyRow" @remove="remove" :is-read-only="false" :title="$t('api_test.definition.request.pre_script')" style-type="color: #B8741A;background-color: #F9F1EA"-->
|
||||||
:jsr223-processor="row"/>
|
<!--:jsr223-processor="row"/>-->
|
||||||
<!--后置脚本-->
|
<!--<!–后置脚本–>-->
|
||||||
<ms-jsr233-processor v-if="row.label ==='JSR223 PostProcessor'" @copyRow="copyRow" @remove="remove" :is-read-only="false" :title="$t('api_test.definition.request.post_script')" style-type="color: #783887;background-color: #F2ECF3"
|
<!--<ms-jsr233-processor v-if="row.label ==='JSR223 PostProcessor'" @copyRow="copyRow" @remove="remove" :is-read-only="false" :title="$t('api_test.definition.request.post_script')" style-type="color: #783887;background-color: #F2ECF3"-->
|
||||||
:jsr223-processor="row"/>
|
<!--:jsr223-processor="row"/>-->
|
||||||
<!--断言规则-->
|
<!--<!–断言规则–>-->
|
||||||
<div style="margin-top: 10px">
|
<!--<div style="margin-top: 10px">-->
|
||||||
<ms-api-assertions v-if="row.type==='Assertions'" @copyRow="copyRow" @remove="remove" :is-read-only="isReadOnly" :assertions="row"/>
|
<!--<ms-api-assertions v-if="row.type==='Assertions'" @copyRow="copyRow" @remove="remove" :is-read-only="isReadOnly" :assertions="row"/>-->
|
||||||
</div>
|
<!--</div>-->
|
||||||
<!--提取规则-->
|
<!--<!–提取规则–>-->
|
||||||
<div style="margin-top: 10px">
|
<!--<div style="margin-top: 10px">-->
|
||||||
<ms-api-extract :is-read-only="isReadOnly" @copyRow="copyRow" @remove="remove" v-if="row.type==='Extract'" :extract="row"/>
|
<!--<ms-api-extract :is-read-only="isReadOnly" @copyRow="copyRow" @remove="remove" v-if="row.type==='Extract'" :extract="row"/>-->
|
||||||
</div>
|
<!--</div>-->
|
||||||
</div>
|
<!--</div>-->
|
||||||
</div>
|
<!--</div>-->
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
<el-col :span="3" class="ms-left-cell" v-if="showScript">
|
<el-col :span="3" class="ms-left-cell" v-if="showScript">
|
||||||
|
|
|
@ -71,24 +71,24 @@
|
||||||
|
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="!referenced">
|
<!--<div v-if="!referenced">-->
|
||||||
<div v-for="row in request.hashTree" :key="row.id">
|
<!--<div v-for="row in request.hashTree" :key="row.id">-->
|
||||||
<!--前置脚本-->
|
<!--<!–前置脚本–>-->
|
||||||
<ms-jsr233-processor v-if="row.type==='JSR223PreProcessor'" @remove="remove" @copyRow="copyRow" :title="$t('api_test.definition.request.pre_script')"
|
<!--<ms-jsr233-processor v-if="row.type==='JSR223PreProcessor'" @remove="remove" @copyRow="copyRow" :title="$t('api_test.definition.request.pre_script')"-->
|
||||||
:jsr223-processor="row"/>
|
<!--:jsr223-processor="row"/>-->
|
||||||
<!--后置脚本-->
|
<!--<!–后置脚本–>-->
|
||||||
<ms-jsr233-processor v-if="row.label ==='JSR223 PostProcessor'" @copyRow="copyRow" @remove="remove" :is-read-only="false" :title="$t('api_test.definition.request.post_script')"
|
<!--<ms-jsr233-processor v-if="row.label ==='JSR223 PostProcessor'" @copyRow="copyRow" @remove="remove" :is-read-only="false" :title="$t('api_test.definition.request.post_script')"-->
|
||||||
:jsr223-processor="row"/>
|
<!--:jsr223-processor="row"/>-->
|
||||||
<!--断言规则-->
|
<!--<!–断言规则–>-->
|
||||||
<div style="margin-top: 10px">
|
<!--<div style="margin-top: 10px">-->
|
||||||
<ms-api-assertions :response="response" v-if="row.type==='Assertions'" @copyRow="copyRow" @remove="remove" :is-read-only="isReadOnly" :assertions="row"/>
|
<!--<ms-api-assertions :response="response" v-if="row.type==='Assertions'" @copyRow="copyRow" @remove="remove" :is-read-only="isReadOnly" :assertions="row"/>-->
|
||||||
</div>
|
<!--</div>-->
|
||||||
<!--提取规则-->
|
<!--<!–提取规则–>-->
|
||||||
<div style="margin-top: 10px">
|
<!--<div style="margin-top: 10px">-->
|
||||||
<ms-api-extract :response="response" :is-read-only="isReadOnly" @copyRow="copyRow" @remove="remove" v-if="row.type==='Extract'" :extract="row"/>
|
<!--<ms-api-extract :response="response" :is-read-only="isReadOnly" @copyRow="copyRow" @remove="remove" v-if="row.type==='Extract'" :extract="row"/>-->
|
||||||
</div>
|
<!--</div>-->
|
||||||
</div>
|
<!--</div>-->
|
||||||
</div>
|
<!--</div>-->
|
||||||
</el-col>
|
</el-col>
|
||||||
<!--操作按钮-->
|
<!--操作按钮-->
|
||||||
<el-col :span="3" class="ms-left-cell" v-if="!referenced && showScript">
|
<el-col :span="3" class="ms-left-cell" v-if="!referenced && showScript">
|
||||||
|
@ -138,14 +138,20 @@
|
||||||
props: {
|
props: {
|
||||||
request: {},
|
request: {},
|
||||||
response: {},
|
response: {},
|
||||||
showScript: Boolean,
|
showScript: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
headers: {
|
headers: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default() {
|
default() {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
referenced: Boolean,
|
referenced: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
isShowEnable: Boolean,
|
isShowEnable: Boolean,
|
||||||
jsonPathList: Array,
|
jsonPathList: Array,
|
||||||
isReadOnly: {
|
isReadOnly: {
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
<p class="tip">{{$t('api_test.definition.request.res_param')}} </p>
|
<p class="tip">{{$t('api_test.definition.request.res_param')}} </p>
|
||||||
<ms-request-result-tail :response="responseData" ref="runResult"/>
|
<ms-request-result-tail :response="responseData" ref="runResult"/>
|
||||||
|
|
||||||
|
<ms-jmx-step :request="api.request" :response="responseData"/>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
<!-- 加载用例 -->
|
<!-- 加载用例 -->
|
||||||
|
@ -53,6 +54,7 @@
|
||||||
import MsRun from "../Run";
|
import MsRun from "../Run";
|
||||||
import MsBasisParameters from "../request/dubbo/BasisParameters";
|
import MsBasisParameters from "../request/dubbo/BasisParameters";
|
||||||
import {REQ_METHOD} from "../../model/JsonData";
|
import {REQ_METHOD} from "../../model/JsonData";
|
||||||
|
import MsJmxStep from "../step/JmxStep";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "RunTestDubboPage",
|
name: "RunTestDubboPage",
|
||||||
|
@ -63,7 +65,8 @@
|
||||||
MsRequestResultTail,
|
MsRequestResultTail,
|
||||||
ApiEnvironmentConfig,
|
ApiEnvironmentConfig,
|
||||||
MsRun,
|
MsRun,
|
||||||
MsBasisParameters
|
MsBasisParameters,
|
||||||
|
MsJmxStep
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -51,6 +51,8 @@
|
||||||
<p class="tip">{{$t('api_test.definition.request.res_param')}} </p>
|
<p class="tip">{{$t('api_test.definition.request.res_param')}} </p>
|
||||||
<ms-request-result-tail :response="responseData" ref="runResult"/>
|
<ms-request-result-tail :response="responseData" ref="runResult"/>
|
||||||
|
|
||||||
|
<ms-jmx-step :request="api.request" :response="responseData"/>
|
||||||
|
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
<!-- 加载用例 -->
|
<!-- 加载用例 -->
|
||||||
|
@ -77,6 +79,7 @@
|
||||||
import MsRun from "../Run";
|
import MsRun from "../Run";
|
||||||
import {REQ_METHOD} from "../../model/JsonData";
|
import {REQ_METHOD} from "../../model/JsonData";
|
||||||
import EnvironmentSelect from "../environment/EnvironmentSelect";
|
import EnvironmentSelect from "../environment/EnvironmentSelect";
|
||||||
|
import MsJmxStep from "../step/JmxStep";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "RunTestHTTPPage",
|
name: "RunTestHTTPPage",
|
||||||
|
@ -86,7 +89,8 @@
|
||||||
MsApiCaseList,
|
MsApiCaseList,
|
||||||
MsContainer,
|
MsContainer,
|
||||||
MsRequestResultTail,
|
MsRequestResultTail,
|
||||||
MsRun
|
MsRun,
|
||||||
|
MsJmxStep
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
<p class="tip">{{$t('api_test.definition.request.res_param')}} </p>
|
<p class="tip">{{$t('api_test.definition.request.res_param')}} </p>
|
||||||
<ms-request-result-tail :response="responseData" :currentProtocol="currentProtocol" ref="runResult"/>
|
<ms-request-result-tail :response="responseData" :currentProtocol="currentProtocol" ref="runResult"/>
|
||||||
|
|
||||||
|
<ms-jmx-step :request="api.request" :response="responseData"/>
|
||||||
|
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
<!-- 加载用例 -->
|
<!-- 加载用例 -->
|
||||||
|
@ -52,6 +54,7 @@
|
||||||
import MsRun from "../Run";
|
import MsRun from "../Run";
|
||||||
import MsBasisParameters from "../request/database/BasisParameters";
|
import MsBasisParameters from "../request/database/BasisParameters";
|
||||||
import {REQ_METHOD} from "../../model/JsonData";
|
import {REQ_METHOD} from "../../model/JsonData";
|
||||||
|
import MsJmxStep from "../step/JmxStep";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "RunTestSQLPage",
|
name: "RunTestSQLPage",
|
||||||
|
@ -62,7 +65,8 @@
|
||||||
MsRequestResultTail,
|
MsRequestResultTail,
|
||||||
ApiEnvironmentConfig,
|
ApiEnvironmentConfig,
|
||||||
MsRun,
|
MsRun,
|
||||||
MsBasisParameters
|
MsBasisParameters,
|
||||||
|
MsJmxStep
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -0,0 +1,233 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<p class="tip">
|
||||||
|
{{$t('test_track.plan_view.step')}}
|
||||||
|
</p>
|
||||||
|
<!-- HTTP 请求参数 -->
|
||||||
|
<div style="border:1px #DCDFE6 solid; height: 100%;border-radius: 4px ;width: 100%" v-loading="isReloadData" v-if="request.hashTree && request.hashTree.length>0">
|
||||||
|
|
||||||
|
<div v-for="row in request.hashTree" :key="row.id">
|
||||||
|
<!--前置脚本-->
|
||||||
|
<ms-jsr233-processor v-if="row.type==='JSR223PreProcessor'" @remove="remove" @copyRow="copyRow" :title="$t('api_test.definition.request.pre_script')"
|
||||||
|
:jsr223-processor="row"/>
|
||||||
|
<!--后置脚本-->
|
||||||
|
<ms-jsr233-processor v-if="row.label ==='JSR223 PostProcessor'" @copyRow="copyRow" @remove="remove" :is-read-only="false" :title="$t('api_test.definition.request.post_script')"
|
||||||
|
:jsr223-processor="row"/>
|
||||||
|
<!--断言规则-->
|
||||||
|
<div style="margin-top: 10px">
|
||||||
|
<ms-api-assertions :response="response" v-if="row.type==='Assertions'" @copyRow="copyRow" @remove="remove" :is-read-only="isReadOnly" :assertions="row"/>
|
||||||
|
</div>
|
||||||
|
<!--提取规则-->
|
||||||
|
<div style="margin-top: 10px">
|
||||||
|
<ms-api-extract :response="response" :is-read-only="isReadOnly" @copyRow="copyRow" @remove="remove" v-if="row.type==='Extract'" :extract="row"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {REQUEST_HEADERS} from "@/common/js/constants";
|
||||||
|
import {createComponent} from "../jmeter/components";
|
||||||
|
import MsApiAssertions from "../assertion/ApiAssertions";
|
||||||
|
import MsApiExtract from "../extract/ApiExtract";
|
||||||
|
import {Assertions, Body, Extract, KeyValue} from "../../model/ApiTestModel";
|
||||||
|
import {getUUID} from "@/common/js/utils";
|
||||||
|
import BatchAddParameter from "../basis/BatchAddParameter";
|
||||||
|
import MsJsr233Processor from "../../../automation/scenario/component/Jsr233Processor";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "MsJmxStep",
|
||||||
|
components: {
|
||||||
|
MsJsr233Processor,
|
||||||
|
BatchAddParameter,
|
||||||
|
MsApiExtract,
|
||||||
|
MsApiAssertions
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
request: {},
|
||||||
|
response: {},
|
||||||
|
showScript: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
headers: {
|
||||||
|
type: Array,
|
||||||
|
default() {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
referenced: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
isShowEnable: Boolean,
|
||||||
|
jsonPathList: Array,
|
||||||
|
isReadOnly: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
data() {
|
||||||
|
let validateURL = (rule, value, callback) => {
|
||||||
|
try {
|
||||||
|
new URL(this.addProtocol(this.request.url));
|
||||||
|
} catch (e) {
|
||||||
|
callback(this.$t('api_test.request.url_invalid'));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return {
|
||||||
|
activeName: "headers",
|
||||||
|
rules: {
|
||||||
|
name: [
|
||||||
|
{max: 300, message: this.$t('commons.input_limit', [1, 300]), trigger: 'blur'}
|
||||||
|
],
|
||||||
|
url: [
|
||||||
|
{max: 500, required: true, message: this.$t('commons.input_limit', [1, 500]), trigger: 'blur'},
|
||||||
|
{validator: validateURL, trigger: 'blur'}
|
||||||
|
],
|
||||||
|
path: [
|
||||||
|
{max: 500, message: this.$t('commons.input_limit', [0, 500]), trigger: 'blur'},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
headerSuggestions: REQUEST_HEADERS,
|
||||||
|
isReloadData: false,
|
||||||
|
isBodyShow: true,
|
||||||
|
dialogVisible: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
created() {
|
||||||
|
this.init();
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
addPre() {
|
||||||
|
let jsr223PreProcessor = createComponent("JSR223PreProcessor");
|
||||||
|
this.request.hashTree.push(jsr223PreProcessor);
|
||||||
|
this.reload();
|
||||||
|
},
|
||||||
|
addPost() {
|
||||||
|
let jsr223PostProcessor = createComponent("JSR223PostProcessor");
|
||||||
|
this.request.hashTree.push(jsr223PostProcessor);
|
||||||
|
this.reload();
|
||||||
|
},
|
||||||
|
addAssertions() {
|
||||||
|
let assertions = new Assertions();
|
||||||
|
this.request.hashTree.push(assertions);
|
||||||
|
this.reload();
|
||||||
|
},
|
||||||
|
addExtract() {
|
||||||
|
let jsonPostProcessor = new Extract();
|
||||||
|
this.request.hashTree.push(jsonPostProcessor);
|
||||||
|
this.reload();
|
||||||
|
},
|
||||||
|
remove(row) {
|
||||||
|
let index = this.request.hashTree.indexOf(row);
|
||||||
|
this.request.hashTree.splice(index, 1);
|
||||||
|
this.reload();
|
||||||
|
},
|
||||||
|
copyRow(row) {
|
||||||
|
let obj = JSON.parse(JSON.stringify(row));
|
||||||
|
obj.id = getUUID();
|
||||||
|
this.request.hashTree.push(obj);
|
||||||
|
this.reload();
|
||||||
|
},
|
||||||
|
reload() {
|
||||||
|
this.isReloadData = true
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.isReloadData = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
init() {
|
||||||
|
if (!this.request.body) {
|
||||||
|
this.request.body = new Body();
|
||||||
|
}
|
||||||
|
if (!this.request.body.kvs) {
|
||||||
|
this.request.body.kvs = [];
|
||||||
|
}
|
||||||
|
if (!this.request.rest) {
|
||||||
|
this.request.rest = [];
|
||||||
|
}
|
||||||
|
if (!this.request.arguments) {
|
||||||
|
this.request.arguments = [];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 解决修改请求头后 body 显示错位
|
||||||
|
reloadBody() {
|
||||||
|
this.isBodyShow = false;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.isBodyShow = true;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
batchAdd() {
|
||||||
|
this.$refs.batchAddParameter.open();
|
||||||
|
},
|
||||||
|
batchSave(data) {
|
||||||
|
if (data) {
|
||||||
|
let params = data.split("\n");
|
||||||
|
let keyValues = [];
|
||||||
|
params.forEach(item => {
|
||||||
|
let line = item.split(/,|,/);
|
||||||
|
let required = false;
|
||||||
|
if (line[1] === '必填' || line[1] === 'true') {
|
||||||
|
required = true;
|
||||||
|
}
|
||||||
|
keyValues.push(new KeyValue({name: line[0], required: required, value: line[2], description: line[3], type: "text", valid: false, file: false, encode: true, enable: true, contentType: "text/plain"}));
|
||||||
|
})
|
||||||
|
keyValues.forEach(item => {
|
||||||
|
switch (this.activeName) {
|
||||||
|
case "parameters":
|
||||||
|
this.request.arguments.unshift(item);
|
||||||
|
break;
|
||||||
|
case "rest":
|
||||||
|
this.request.rest.unshift(item);
|
||||||
|
break;
|
||||||
|
case "headers":
|
||||||
|
this.request.headers.unshift(item);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.ms-left-cell .el-button:nth-of-type(1) {
|
||||||
|
color: #B8741A;
|
||||||
|
background-color: #F9F1EA;
|
||||||
|
border: #F9F1EA;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ms-left-cell .el-button:nth-of-type(2) {
|
||||||
|
color: #783887;
|
||||||
|
background-color: #F2ECF3;
|
||||||
|
border: #F2ECF3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ms-left-cell .el-button:nth-of-type(3) {
|
||||||
|
color: #A30014;
|
||||||
|
background-color: #F7E6E9;
|
||||||
|
border: #F7E6E9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ms-left-cell .el-button:nth-of-type(4) {
|
||||||
|
color: #015478;
|
||||||
|
background-color: #E6EEF2;
|
||||||
|
border: #E6EEF2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tip {
|
||||||
|
padding: 3px 5px;
|
||||||
|
font-size: 16px;
|
||||||
|
border-radius: 4px;
|
||||||
|
border-left: 4px solid #783887;
|
||||||
|
margin: 20px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
Loading…
Reference in New Issue