This commit is contained in:
fit2-zhao 2020-11-27 18:32:10 +08:00
commit 1e558b202d
18 changed files with 77 additions and 21 deletions

View File

@ -4,7 +4,7 @@ MAINTAINER FIT2CLOUD <support@fit2cloud.com>
ARG MS_VERSION=dev ARG MS_VERSION=dev
RUN mkdir -p /opt/apps && mkdir -p /opt/jmeter RUN mkdir -p /opt/apps && mkdir -p /opt/jmeter/lib/junit
COPY backend/target/backend-1.5.jar /opt/apps COPY backend/target/backend-1.5.jar /opt/apps

View File

@ -21,4 +21,5 @@ public class Scenario {
private TCPConfig tcpConfig; private TCPConfig tcpConfig;
private List<DatabaseConfig> databaseConfigs; private List<DatabaseConfig> databaseConfigs;
private boolean enable = true; private boolean enable = true;
private Boolean referenceEnable;
} }

View File

@ -38,4 +38,5 @@ public interface ExtTestPlanTestCaseMapper {
*/ */
List<TestPlanCaseDTO> listTestCaseByProjectIds(@Param("ids") List<String> ids); List<TestPlanCaseDTO> listTestCaseByProjectIds(@Param("ids") List<String> ids);
TestPlanCaseDTO get(String testPlanTestCaseId);
} }

View File

@ -307,6 +307,16 @@
</if> </if>
</where> </where>
</select> </select>
<select id="get" resultType="io.metersphere.track.dto.TestPlanCaseDTO">
select test_case.remark, test_plan_test_case.id as id, test_plan_test_case.*,test_case.*,test_case_node.name as model, project.name as projectName
from test_plan_test_case
inner join test_case on test_plan_test_case.case_id = test_case.id
left join test_case_node on test_case_node.id=test_case.node_id
inner join project on project.id = test_case.project_id
where test_plan_test_case.id = #{testPlanTestCaseId}
</select>
<update id="updateTestCaseStates" parameterType="java.lang.String"> <update id="updateTestCaseStates" parameterType="java.lang.String">
update test_plan_test_case update test_plan_test_case
<set> <set>

View File

@ -105,6 +105,9 @@ public class ReportService {
example.createCriteria().andReportIdEqualTo(reportId); example.createCriteria().andReportIdEqualTo(reportId);
loadTestReportDetailMapper.deleteByExample(example); loadTestReportDetailMapper.deleteByExample(example);
// delete jtl file
fileService.deleteFileById(loadTestReport.getFileId());
loadTestReportMapper.deleteByPrimaryKey(reportId); loadTestReportMapper.deleteByPrimaryKey(reportId);
} }

View File

@ -129,10 +129,8 @@ public class TestPlanTestCaseService {
request.setExecutor(user.getId()); request.setExecutor(user.getId());
} }
public TestPlanCaseDTO get(String caseId) { public TestPlanCaseDTO get(String testplanTestCaseId) {
QueryTestPlanCaseRequest request = new QueryTestPlanCaseRequest(); return extTestPlanTestCaseMapper.get(testplanTestCaseId);
request.setId(caseId);
return extTestPlanTestCaseMapper.list(request).get(0);
} }
public void deleteTestCaseBath(TestPlanCaseBatchRequest request) { public void deleteTestCaseBath(TestPlanCaseBatchRequest request) {

@ -1 +1 @@
Subproject commit 419c75bca64b7c5bfbd1194d7f0fd9919f0caa04 Subproject commit bb494fc68a2367359c9048fa7250c7618de4afb6

View File

@ -117,6 +117,12 @@
} }
}, },
watch: {
'request.responseResult'() {
this.reload();
}
},
computed: { computed: {
assertion() { assertion() {
return this.request.passAssertions + " / " + this.request.totalAssertions; return this.request.passAssertions + " / " + this.request.totalAssertions;

View File

@ -171,7 +171,11 @@ export default {
let scenarios = []; let scenarios = [];
this.test.scenarioDefinition.forEach(scenario => { this.test.scenarioDefinition.forEach(scenario => {
if (scenario.isReference()) { if (scenario.isReference()) {
if (scenarioMap[scenario.id]) scenarios.push(scenarioMap[scenario.id]); if (scenarioMap[scenario.id]) {
let item = scenarioMap[scenario.id];
item.referenceEnable = scenario.referenceEnable;
scenarios.push(item);
}
} else { } else {
scenarios.push(scenario); scenarios.push(scenario);
} }

View File

@ -5,7 +5,7 @@
<ms-api-collapse v-model="activeName" @change="handleChange"> <ms-api-collapse v-model="activeName" @change="handleChange">
<draggable :list="scenarios" group="Scenario" class="scenario-draggable" ghost-class="scenario-ghost"> <draggable :list="scenarios" group="Scenario" class="scenario-draggable" ghost-class="scenario-ghost">
<ms-api-collapse-item v-for="(scenario, index) in scenarios" :key="index" <ms-api-collapse-item v-for="(scenario, index) in scenarios" :key="index"
:title="scenario.name" :name="index" :class="{'disable-scenario': !scenario.enable}"> :title="scenario.name" :name="index" :class="{'disable-scenario': !scenario.isEnable()}">
<template slot="title"> <template slot="title">
<div class="scenario-name"> <div class="scenario-name">
<el-tag type="info" size="small" v-if="scenario.isReference()">{{ <el-tag type="info" size="small" v-if="scenario.isReference()">{{
@ -26,11 +26,11 @@
<el-dropdown-item :disabled="isReadOnly" :command="{type:'delete', index:index}"> <el-dropdown-item :disabled="isReadOnly" :command="{type:'delete', index:index}">
{{ $t('api_test.scenario.delete') }} {{ $t('api_test.scenario.delete') }}
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item v-if="scenario.enable" :disabled="isReadOnly" <el-dropdown-item v-if="scenario.isEnable()" :disabled="isReadOnly"
:command="{type:'disable', index:index}"> :command="{type:'disable', index:index}">
{{ $t('api_test.scenario.disable') }} {{ $t('api_test.scenario.disable') }}
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item v-if="!scenario.enable" :disabled="isReadOnly" <el-dropdown-item v-if="!scenario.isEnable()" :disabled="isReadOnly"
:command="{type:'enable', index:index}"> :command="{type:'enable', index:index}">
{{ $t('api_test.scenario.enable') }} {{ $t('api_test.scenario.enable') }}
</el-dropdown-item> </el-dropdown-item>
@ -156,10 +156,20 @@ export default {
} }
}, },
disableScenario(index) { disableScenario(index) {
this.scenarios[index].enable = false; let scenario = this.scenarios[index];
if (scenario.isReference()) {
scenario.referenceEnable = false;
} else {
scenario.enable = false;
}
}, },
enableScenario(index) { enableScenario(index) {
this.scenarios[index].enable = true; let scenario = this.scenarios[index];
if (scenario.isReference()) {
scenario.referenceEnable = true;
} else {
scenario.enable = true;
}
}, },
handleChange(index) { handleChange(index) {
this.select(this.scenarios[index]); this.select(this.scenarios[index]);

View File

@ -3,7 +3,7 @@
<draggable :list="this.scenario.requests" group="Request" class="request-draggable" ghost-class="request-ghost" <draggable :list="this.scenario.requests" group="Request" class="request-draggable" ghost-class="request-ghost"
:disabled="isReference"> :disabled="isReference">
<div class="request-item" v-for="(request, index) in this.scenario.requests" :key="index" @click="select(request)" <div class="request-item" v-for="(request, index) in this.scenario.requests" :key="index" @click="select(request)"
:class="{'selected': isSelected(request), 'disable-request': !request.enable || !scenario.enable}"> :class="{'selected': isSelected(request), 'disable-request': isEnable(request)}">
<ms-condition-label :request="request"/> <ms-condition-label :request="request"/>
<el-row type="flex" align="middle"> <el-row type="flex" align="middle">
<div class="request-type"> <div class="request-type">
@ -180,7 +180,10 @@ export default {
request.dubboConfig = this.scenario.dubboConfig; request.dubboConfig = this.scenario.dubboConfig;
this.selected = request; this.selected = request;
this.$emit("select", request, this.scenario); this.$emit("select", request, this.scenario);
} },
isEnable(request) {
return !request.enable || !this.scenario.isEnable();
},
}, },
created() { created() {

View File

@ -101,7 +101,6 @@ export default {
this.request.debugScenario = new Scenario(); this.request.debugScenario = new Scenario();
this.request.debugRequestResult = {responseResult: {}, subRequestResults: []}; this.request.debugRequestResult = {responseResult: {}, subRequestResults: []};
} }
this.$refs.msDebugResult.reload();
} else { } else {
setTimeout(this.getReport, 2000) setTimeout(this.getReport, 2000)
} }

View File

@ -58,7 +58,11 @@
this.currentConfig = new DatabaseConfig(); this.currentConfig = new DatabaseConfig();
}, },
rowSelect(config) { rowSelect(config) {
this.currentConfig = config; //
this.currentConfig = {};
this.$nextTick(() => {
this.currentConfig = config;
});
} }
} }
} }

View File

@ -80,4 +80,8 @@
float: right; float: right;
} }
.el-table {
cursor: pointer;
}
</style> </style>

View File

@ -39,9 +39,10 @@
<el-form-item> <el-form-item>
<div class="buttons"> <div class="buttons">
<el-button type="primary" v-show="currentConfig.id" size="small" @click="validate()">{{$t('commons.validate')}}</el-button> <el-button type="primary" v-show="currentConfig.id" size="small" @click="validate">{{$t('commons.validate')}}</el-button>
<el-button type="primary" v-show="currentConfig.id" size="small" @click="save('update')">{{$t('commons.update')}}</el-button> <el-button type="primary" v-show="currentConfig.id" size="small" @click="save('update')">{{$t('commons.update')}}</el-button>
<el-button type="primary" size="small" @click="save('add')">{{$t('commons.add')}}</el-button> <el-button type="primary" v-show="currentConfig.id" size="small" @click="clear">{{$t('commons.clear')}}</el-button>
<el-button type="primary" v-show="!currentConfig.id" size="small" @click="save('add')">{{$t('commons.add')}}</el-button>
</div> </div>
</el-form-item> </el-form-item>
@ -127,6 +128,9 @@
} }
}); });
}, },
clear() {
this.currentConfig = new DatabaseConfig();
},
validate() { validate() {
this.result = this.$post('/api/database/validate', this.currentConfig, () => { this.result = this.$post('/api/database/validate', this.currentConfig, () => {
this.$success(this.$t('commons.connection_successful')); this.$success(this.$t('commons.connection_successful'));

View File

@ -230,6 +230,7 @@ export class Scenario extends BaseConfig {
this.databaseConfigs = []; this.databaseConfigs = [];
this.tcpConfig = undefined; this.tcpConfig = undefined;
this.assertions = undefined; this.assertions = undefined;
this.referenceEnable = undefined;
this.set(options); this.set(options);
this.sets({ this.sets({
@ -271,6 +272,14 @@ export class Scenario extends BaseConfig {
isReference() { isReference() {
return this.id.indexOf("#") !== -1 return this.id.indexOf("#") !== -1
} }
isEnable() {
if (this.isReference()) {
return this.referenceEnable;
} else {
return this.enable;
}
}
} }
class DubboConfig extends BaseConfig { class DubboConfig extends BaseConfig {
@ -1144,7 +1153,7 @@ class JMXGenerator {
addScenarios(testPlan, testId, scenarios) { addScenarios(testPlan, testId, scenarios) {
scenarios.forEach(s => { scenarios.forEach(s => {
if (s.enable) { if (s.isEnable()) {
let scenario = s.clone(); let scenario = s.clone();
let threadGroup = new ThreadGroup(scenario.name || ""); let threadGroup = new ThreadGroup(scenario.name || "");

View File

@ -85,7 +85,7 @@
}); });
}, },
editTestCase(row, event, column) { editTestCase(row, event, column) {
this.$router.push('/track/plan/view/edit/' + row.caseId) this.$router.push('/track/plan/view/edit/' + row.id)
} }
} }
} }

@ -1 +1 @@
Subproject commit 33bbdb3f528c914bf333b2c1839dd6d3bbd9b569 Subproject commit 8a972a198775b3783ed6e4cef27197e53d1ebdc8