refactor(接口测试): 引用设置优化
This commit is contained in:
parent
45651d1973
commit
2e44835dcb
|
@ -201,7 +201,9 @@ public class ApiCaseExecuteService {
|
||||||
report.setName(caseWithBLOBs.getName());
|
report.setName(caseWithBLOBs.getName());
|
||||||
report.setProjectId(caseWithBLOBs.getProjectId());
|
report.setProjectId(caseWithBLOBs.getProjectId());
|
||||||
report.setVersionId(caseWithBLOBs.getVersionId());
|
report.setVersionId(caseWithBLOBs.getVersionId());
|
||||||
|
if (StringUtils.isNotEmpty(finalSerialReportId)) {
|
||||||
report.setIntegratedReportId(finalSerialReportId);
|
report.setIntegratedReportId(finalSerialReportId);
|
||||||
|
}
|
||||||
executeQueue.put(caseWithBLOBs.getId(), report);
|
executeQueue.put(caseWithBLOBs.getId(), report);
|
||||||
responseDTOS.add(new MsExecResponseDTO(caseWithBLOBs.getId(), report.getId(), request.getTriggerMode()));
|
responseDTOS.add(new MsExecResponseDTO(caseWithBLOBs.getId(), report.getId(), request.getTriggerMode()));
|
||||||
});
|
});
|
||||||
|
|
|
@ -701,6 +701,7 @@ public class ApiAutomationService {
|
||||||
} else {
|
} else {
|
||||||
String scenarioId = request.getId();
|
String scenarioId = request.getId();
|
||||||
ApiScenarioWithBLOBs apiScenarioWithBLOBs = apiScenarioMapper.selectByPrimaryKey(scenarioId);
|
ApiScenarioWithBLOBs apiScenarioWithBLOBs = apiScenarioMapper.selectByPrimaryKey(scenarioId);
|
||||||
|
if (apiScenarioWithBLOBs != null) {
|
||||||
String environmentType = apiScenarioWithBLOBs.getEnvironmentType();
|
String environmentType = apiScenarioWithBLOBs.getEnvironmentType();
|
||||||
String environmentGroupId = apiScenarioWithBLOBs.getEnvironmentGroupId();
|
String environmentGroupId = apiScenarioWithBLOBs.getEnvironmentGroupId();
|
||||||
String environmentJson = apiScenarioWithBLOBs.getEnvironmentJson();
|
String environmentJson = apiScenarioWithBLOBs.getEnvironmentJson();
|
||||||
|
@ -710,6 +711,7 @@ public class ApiAutomationService {
|
||||||
environmentMap = JSON.parseObject(environmentJson, Map.class);
|
environmentMap = JSON.parseObject(environmentJson, Map.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ParameterConfig config = new ParameterConfig();
|
ParameterConfig config = new ParameterConfig();
|
||||||
|
|
|
@ -127,7 +127,7 @@
|
||||||
'Saved' as execute_type,
|
'Saved' as execute_type,
|
||||||
'API_INDEPENDENT' as report_type
|
'API_INDEPENDENT' as report_type
|
||||||
from api_definition_exec_result a_r
|
from api_definition_exec_result a_r
|
||||||
where a_r.integrated_report_id is null
|
where a_r.integrated_report_id is null or a_r.integrated_report_id = 'null'
|
||||||
) r
|
) r
|
||||||
<where>
|
<where>
|
||||||
<if test="request.combine != null">
|
<if test="request.combine != null">
|
||||||
|
@ -211,7 +211,7 @@
|
||||||
'Saved' as execute_type,
|
'Saved' as execute_type,
|
||||||
'API_INDEPENDENT' as report_type
|
'API_INDEPENDENT' as report_type
|
||||||
from api_definition_exec_result a_r
|
from api_definition_exec_result a_r
|
||||||
where a_r.integrated_report_id is null
|
where a_r.integrated_report_id is null or a_r.integrated_report_id = 'null'
|
||||||
) r
|
) r
|
||||||
<where>
|
<where>
|
||||||
<if test="request.combine != null">
|
<if test="request.combine != null">
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
<if test="request.executor != null and request.executor != ''">
|
<if test="request.executor != null and request.executor != ''">
|
||||||
and t.user_id = #{request.executor}
|
and t.user_id = #{request.executor}
|
||||||
</if>
|
</if>
|
||||||
and t.integrated_report_id is null
|
and (t.integrated_report_id is null or t.integrated_report_id = 'null')
|
||||||
)
|
)
|
||||||
UNION ALL
|
UNION ALL
|
||||||
(select t.id,t.name,'PERFORMANCE' as executionModule, ifnull(t2.name,'LOCAL') as actuator, t1.`name` as executor,t.create_time as executionTime, t.trigger_mode as triggerMode ,t.`status` as executionStatus
|
(select t.id,t.name,'PERFORMANCE' as executionModule, ifnull(t2.name,'LOCAL') as actuator, t1.`name` as executor,t.create_time as executionTime, t.trigger_mode as triggerMode ,t.`status` as executionStatus
|
||||||
|
@ -80,7 +80,7 @@
|
||||||
from api_definition_exec_result t left join `user` t1 ON t.user_id = t1.id left join test_resource_pool t2 on t.actuator = t2.id
|
from api_definition_exec_result t left join `user` t1 ON t.user_id = t1.id left join test_resource_pool t2 on t.actuator = t2.id
|
||||||
left join api_definition t3 on t.resource_id = t3.id left join api_test_case t4 on t4.id = t.resource_id
|
left join api_definition t3 on t.resource_id = t3.id left join api_test_case t4 on t4.id = t.resource_id
|
||||||
left join test_plan_api_case t5 on t.resource_id = t5.id left join test_plan t6 on t5.test_plan_id = t6.id
|
left join test_plan_api_case t5 on t.resource_id = t5.id left join test_plan t6 on t5.test_plan_id = t6.id
|
||||||
where to_days(FROM_UNIXTIME(t.create_time/1000))= to_days(now()) and t.integrated_report_id is null and (t3.project_id =#{request.projectId} OR t4.project_id =#{request.projectId} OR t6.project_id = #{request.projectId}) and t.status not in ("saved","completed","success","error","STOP")
|
where to_days(FROM_UNIXTIME(t.create_time/1000))= to_days(now()) and (t.integrated_report_id is null t.integrated_report_id='null') and (t3.project_id =#{request.projectId} OR t4.project_id =#{request.projectId} OR t6.project_id = #{request.projectId}) and t.status not in ("saved","completed","success","error","STOP")
|
||||||
)
|
)
|
||||||
UNION ALL
|
UNION ALL
|
||||||
(select t.id,t.create_time as executionTime
|
(select t.id,t.create_time as executionTime
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
<slot name="afterTitle"/>
|
<slot name="afterTitle"/>
|
||||||
</span>
|
</span>
|
||||||
</slot>
|
</slot>
|
||||||
<slot name="scenarioEnable"/>
|
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<div v-if="!ifFromVariableAdvance" class="header-right" @click.stop>
|
<div v-if="!ifFromVariableAdvance" class="header-right" @click.stop>
|
||||||
|
@ -39,7 +38,15 @@
|
||||||
<el-tooltip content="Copy" placement="top" v-if="showVersion">
|
<el-tooltip content="Copy" placement="top" v-if="showVersion">
|
||||||
<el-button size="mini" icon="el-icon-copy-document" circle @click="copyRow" style="padding: 5px" :disabled="data.disabled && !data.root"/>
|
<el-button size="mini" icon="el-icon-copy-document" circle @click="copyRow" style="padding: 5px" :disabled="data.disabled && !data.root"/>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<step-extend-btns style="display: contents" :data="data" @copy="copyRow" @remove="remove" @openScenario="openScenario" v-if="showBtn && (!data.disabled || data.root)&&showVersion"/>
|
<step-extend-btns style="display: contents"
|
||||||
|
:data="data"
|
||||||
|
:environmentType="environmentType"
|
||||||
|
:environmentGroupId="environmentGroupId"
|
||||||
|
:envMap="envMap"
|
||||||
|
@copy="copyRow"
|
||||||
|
@remove="remove"
|
||||||
|
@openScenario="openScenario"
|
||||||
|
v-if="showBtn && (!data.disabled || data.root) &&showVersion"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -66,6 +73,7 @@
|
||||||
<script>
|
<script>
|
||||||
import StepExtendBtns from "../component/StepExtendBtns";
|
import StepExtendBtns from "../component/StepExtendBtns";
|
||||||
import {STEP} from "../Setting";
|
import {STEP} from "../Setting";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ApiBaseComponent",
|
name: "ApiBaseComponent",
|
||||||
components: {StepExtendBtns},
|
components: {StepExtendBtns},
|
||||||
|
@ -124,7 +132,10 @@ export default {
|
||||||
ifFromVariableAdvance: {
|
ifFromVariableAdvance: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
}
|
},
|
||||||
|
environmentType: String,
|
||||||
|
environmentGroupId: String,
|
||||||
|
envMap: Map,
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
'$store.state.selectStep': function () {
|
'$store.state.selectStep': function () {
|
||||||
|
@ -240,6 +251,7 @@ export default {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
width: 140px;
|
width: 140px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.scenario-version {
|
.scenario-version {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
|
@ -254,30 +266,31 @@ export default {
|
||||||
width: calc(100% - 23rem);
|
width: calc(100% - 23rem);
|
||||||
height: auto;
|
height: auto;
|
||||||
}
|
}
|
||||||
.scenario-version::-webkit-scrollbar
|
|
||||||
{
|
.scenario-version::-webkit-scrollbar {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*定义滚动条轨道 内阴影+圆角*/
|
/*定义滚动条轨道 内阴影+圆角*/
|
||||||
.scenario-version::-webkit-scrollbar-track
|
.scenario-version::-webkit-scrollbar-track {
|
||||||
{
|
|
||||||
-webkit-box-shadow: inset 0 0 6px #fff;
|
-webkit-box-shadow: inset 0 0 6px #fff;
|
||||||
border-radius: 1px;
|
border-radius: 1px;
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*定义滑块 内阴影+圆角*/
|
/*定义滑块 内阴影+圆角*/
|
||||||
.scenario-version::-webkit-scrollbar-thumb
|
.scenario-version::-webkit-scrollbar-thumb {
|
||||||
{
|
|
||||||
border-radius: 1px;
|
border-radius: 1px;
|
||||||
-webkit-box-shadow: inset 0 0 6px #fff;
|
-webkit-box-shadow: inset 0 0 6px #fff;
|
||||||
background-color: #783887;
|
background-color: #783887;
|
||||||
}
|
}
|
||||||
|
|
||||||
.scenario-version::-webkit-scrollbar {
|
.scenario-version::-webkit-scrollbar {
|
||||||
/* width: 0px; */
|
/* width: 0px; */
|
||||||
height: 3px;
|
height: 3px;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
}
|
}
|
||||||
|
|
||||||
.scenario-name {
|
.scenario-name {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
|
@ -296,25 +309,25 @@ export default {
|
||||||
scrollbar-track-color: transparent;
|
scrollbar-track-color: transparent;
|
||||||
-ms-scrollbar-track-color: transparent;
|
-ms-scrollbar-track-color: transparent;
|
||||||
}
|
}
|
||||||
.scenario-name::-webkit-scrollbar
|
|
||||||
{
|
.scenario-name::-webkit-scrollbar {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*定义滚动条轨道 内阴影+圆角*/
|
/*定义滚动条轨道 内阴影+圆角*/
|
||||||
.scenario-name::-webkit-scrollbar-track
|
.scenario-name::-webkit-scrollbar-track {
|
||||||
{
|
|
||||||
-webkit-box-shadow: inset 0 0 6px #fff;
|
-webkit-box-shadow: inset 0 0 6px #fff;
|
||||||
border-radius: 1px;
|
border-radius: 1px;
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*定义滑块 内阴影+圆角*/
|
/*定义滑块 内阴影+圆角*/
|
||||||
.scenario-name::-webkit-scrollbar-thumb
|
.scenario-name::-webkit-scrollbar-thumb {
|
||||||
{
|
|
||||||
border-radius: 1px;
|
border-radius: 1px;
|
||||||
-webkit-box-shadow: inset 0 0 6px #fff;
|
-webkit-box-shadow: inset 0 0 6px #fff;
|
||||||
background-color: #783887;
|
background-color: #783887;
|
||||||
}
|
}
|
||||||
|
|
||||||
.scenario-name::-webkit-scrollbar {
|
.scenario-name::-webkit-scrollbar {
|
||||||
/* width: 0px; */
|
/* width: 0px; */
|
||||||
height: 3px;
|
height: 3px;
|
||||||
|
|
|
@ -15,6 +15,9 @@
|
||||||
color="#606266"
|
color="#606266"
|
||||||
background-color="#F4F4F5"
|
background-color="#F4F4F5"
|
||||||
:if-from-variable-advance="ifFromVariableAdvance"
|
:if-from-variable-advance="ifFromVariableAdvance"
|
||||||
|
:environmentType="environmentType"
|
||||||
|
:environmentGroupId="environmentGroupId"
|
||||||
|
:envMap="envMap"
|
||||||
:title="$t('commons.scenario')">
|
:title="$t('commons.scenario')">
|
||||||
|
|
||||||
<template v-slot:afterTitle v-if="isSameSpace">
|
<template v-slot:afterTitle v-if="isSameSpace">
|
||||||
|
@ -42,26 +45,6 @@
|
||||||
{{ getCode() }}
|
{{ getCode() }}
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:scenarioEnable v-if="!ifFromVariableAdvance">
|
|
||||||
<el-popover
|
|
||||||
placement="bottom"
|
|
||||||
width="200"
|
|
||||||
trigger="click">
|
|
||||||
<ul>
|
|
||||||
<el-tooltip :content="$t('commons.enable_scene_info')" placement="top">-->
|
|
||||||
<el-checkbox v-model="scenario.environmentEnable" @change="checkEnv" :disabled="scenario.disabled">
|
|
||||||
{{ $t('commons.enable_scene') }}
|
|
||||||
</el-checkbox>
|
|
||||||
</el-tooltip>
|
|
||||||
<el-checkbox v-model="scenario.variableEnable" :disabled="scenario.disabled">
|
|
||||||
{{ $t('commons.variable_scene') }}
|
|
||||||
</el-checkbox>
|
|
||||||
</ul>
|
|
||||||
<span class="el-dropdown-link ms-test-running" slot="reference" @click.stop>
|
|
||||||
{{ $t('commons.reference_settings') }}
|
|
||||||
</span>
|
|
||||||
</el-popover>
|
|
||||||
</template>
|
|
||||||
<template v-slot:button v-if="!ifFromVariableAdvance">
|
<template v-slot:button v-if="!ifFromVariableAdvance">
|
||||||
<el-tooltip :content="$t('api_test.run')" placement="top" v-if="!scenario.run">
|
<el-tooltip :content="$t('api_test.run')" placement="top" v-if="!scenario.run">
|
||||||
<el-button :disabled="!scenario.enable" @click="run" icon="el-icon-video-play" style="padding: 5px" class="ms-btn" size="mini" circle/>
|
<el-button :disabled="!scenario.enable" @click="run" icon="el-icon-video-play" style="padding: 5px" class="ms-btn" size="mini" circle/>
|
||||||
|
|
|
@ -15,10 +15,30 @@
|
||||||
<el-dropdown-item command="saveAs" v-if="allSamplers.indexOf(data.type)!=-1 && (data.referenced===undefined || data.referenced ==='Created' )">
|
<el-dropdown-item command="saveAs" v-if="allSamplers.indexOf(data.type)!=-1 && (data.referenced===undefined || data.referenced ==='Created' )">
|
||||||
{{ this.$t("api_test.automation.save_as_api") }}
|
{{ this.$t("api_test.automation.save_as_api") }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
|
<el-dropdown-item command="setScenario" v-if="data.type==='scenario'">
|
||||||
|
{{ $t('commons.reference_settings') }}
|
||||||
|
</el-dropdown-item>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
<ms-variable-list ref="scenarioParameters" @setVariables="setVariables"/>
|
<ms-variable-list ref="scenarioParameters" @setVariables="setVariables"/>
|
||||||
<ms-add-basis-api :currentProtocol="currentProtocol" ref="api"/>
|
<ms-add-basis-api :currentProtocol="currentProtocol" ref="api"/>
|
||||||
|
|
||||||
|
|
||||||
|
<el-dialog
|
||||||
|
:title="$t('commons.reference_settings')"
|
||||||
|
:visible.sync="dialogVisible" width="400px">
|
||||||
|
<ul>
|
||||||
|
<el-tooltip :content="$t('commons.enable_scene_info')" placement="top">-->
|
||||||
|
<el-checkbox v-model="data.environmentEnable" @change="checkEnv" :disabled="data.disabled">
|
||||||
|
{{ $t('commons.enable_scene') }}
|
||||||
|
</el-checkbox>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-checkbox v-model="data.variableEnable" :disabled="data.disabled">
|
||||||
|
{{ $t('commons.variable_scene') }}
|
||||||
|
</el-checkbox>
|
||||||
|
</ul>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -26,19 +46,23 @@
|
||||||
import {STEP} from "../Setting";
|
import {STEP} from "../Setting";
|
||||||
import MsVariableList from "../variable/VariableList";
|
import MsVariableList from "../variable/VariableList";
|
||||||
import MsAddBasisApi from "../api/AddBasisApi";
|
import MsAddBasisApi from "../api/AddBasisApi";
|
||||||
import {getCurrentProjectID, getUUID} from "@/common/js/utils";
|
import {getCurrentProjectID, getUUID, strMapToObj} from "@/common/js/utils";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "StepExtendBtns",
|
name: "StepExtendBtns",
|
||||||
components: {STEP, MsVariableList, MsAddBasisApi},
|
components: {STEP, MsVariableList, MsAddBasisApi},
|
||||||
props: {
|
props: {
|
||||||
data: Object,
|
data: Object,
|
||||||
|
environmentType: String,
|
||||||
|
environmentGroupId: String,
|
||||||
|
envMap: Map,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
allSamplers: [],
|
allSamplers: [],
|
||||||
currentProtocol: "HTTP",
|
currentProtocol: "HTTP",
|
||||||
filter: new STEP,
|
filter: new STEP,
|
||||||
|
dialogVisible: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
@ -62,11 +86,17 @@ export default {
|
||||||
case "saveAs":
|
case "saveAs":
|
||||||
this.saveAsApi();
|
this.saveAsApi();
|
||||||
break;
|
break;
|
||||||
|
case "setScenario":
|
||||||
|
this.setScenario();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setVariables(v, h) {
|
setVariables(v, h) {
|
||||||
this.data.variables = v;
|
this.data.variables = v;
|
||||||
},
|
},
|
||||||
|
setScenario() {
|
||||||
|
this.dialogVisible = true;
|
||||||
|
},
|
||||||
getScenario() {
|
getScenario() {
|
||||||
this.result = this.$get("/api/automation/getApiScenario/" + this.data.id, response => {
|
this.result = this.$get("/api/automation/getApiScenario/" + this.data.id, response => {
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
|
@ -84,6 +114,32 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
checkEnv(val) {
|
||||||
|
this.$get("/api/automation/checkScenarioEnv/" + this.data.id, res => {
|
||||||
|
if (this.data.environmentEnable && !res.data) {
|
||||||
|
this.data.environmentEnable = false;
|
||||||
|
this.$warning(this.$t('commons.scenario_warning'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.setDomain(val);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
setDomain(val) {
|
||||||
|
let param = {
|
||||||
|
environmentEnable: val,
|
||||||
|
id: this.data.id,
|
||||||
|
environmentType: this.environmentType,
|
||||||
|
environmentGroupId: this.environmentGroupId,
|
||||||
|
environmentMap: strMapToObj(this.envMap),
|
||||||
|
definition: JSON.stringify(this.data)
|
||||||
|
}
|
||||||
|
this.$post("/api/automation/setDomain", param, res => {
|
||||||
|
if (res.data) {
|
||||||
|
let data = JSON.parse(res.data);
|
||||||
|
this.data.hashTree = data.hashTree;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
saveAsApi() {
|
saveAsApi() {
|
||||||
this.currentProtocol = this.data.protocol;
|
this.currentProtocol = this.data.protocol;
|
||||||
this.$refs.api.open(this.data);
|
this.$refs.api.open(this.data);
|
||||||
|
|
Loading…
Reference in New Issue