测试计划-测试用例关联测试

This commit is contained in:
chenjianxing 2020-05-28 14:27:11 +08:00
parent bceade43a9
commit 5cd7841004
5 changed files with 61 additions and 8 deletions

View File

@ -74,8 +74,12 @@
<el-col :span="12"> <el-col :span="12">
<el-form-item :label="$t('test_track.case.method')" :label-width="formLabelWidth" prop="method"> <el-form-item :label="$t('test_track.case.method')" :label-width="formLabelWidth" prop="method">
<el-select :disabled="readOnly" v-model="form.method" :placeholder="$t('test_track.case.input_method')"> <el-select :disabled="readOnly" v-model="form.method" :placeholder="$t('test_track.case.input_method')">
<el-option :label="$t('test_track.case.manual')" value="manual"></el-option> <el-option
<el-option :label="$t('test_track.case.auto')" value="auto"></el-option> v-for="item in methodOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -111,11 +115,11 @@
</el-col> </el-col>
</el-row> </el-row>
<el-row style="margin-bottom: 10px"> <el-row v-if="form.method && form.method != 'auto'" style="margin-bottom: 10px">
<el-col :offset="2">{{$t('test_track.case.steps')}}:</el-col> <el-col :offset="2">{{$t('test_track.case.steps')}}:</el-col>
</el-row> </el-row>
<el-row type="flex" justify="center"> <el-row v-if="form.method && form.method != 'auto'" type="flex" justify="center">
<el-col :span="20"> <el-col :span="20">
<el-table <el-table
:data="form.steps" :data="form.steps"
@ -238,6 +242,7 @@
}, },
moduleOptions: [], moduleOptions: [],
maintainerOptions: [], maintainerOptions: [],
methodOptions: [],
testOptions: [], testOptions: [],
workspaceId: '', workspaceId: '',
rules:{ rules:{
@ -283,7 +288,6 @@
methods: { methods: {
open(testCase) { open(testCase) {
this.resetForm(); this.resetForm();
this.getSelectOptions();
this.operationType = 'add'; this.operationType = 'add';
if(testCase){ if(testCase){
// //
@ -311,6 +315,8 @@
this.form.method = 'manual'; this.form.method = 'manual';
this.form.maintainer = user.id; this.form.maintainer = user.id;
} }
this.getSelectOptions();
this.dialogFormVisible = true; this.dialogFormVisible = true;
}, },
handleAddStep(index, data) { handleAddStep(index, data) {
@ -389,6 +395,7 @@
}, },
typeChange() { typeChange() {
this.form.testId = ''; this.form.testId = '';
this.getMethodOptions();
this.getTestOptions() this.getTestOptions()
}, },
getModuleOptions() { getModuleOptions() {
@ -412,10 +419,22 @@
}); });
} }
}, },
getMethodOptions() {
if (!this.form.type || this.form.type != 'functional') {
this.methodOptions = [
{value: 'auto', label: this.$t('test_track.case.auto')},
{value: 'manual', label: this.$t('test_track.case.manual')}
];
} else {
this.form.method = 'manual';
this.methodOptions = [{value: 'manual', label: this.$t('test_track.case.manual')}]
}
},
getSelectOptions() { getSelectOptions() {
this.getModuleOptions(); this.getModuleOptions();
this.getMaintainerOptions(); this.getMaintainerOptions();
this.getTestOptions(); this.getTestOptions();
this.getMethodOptions();
}, },
buildNodePath(node, option, moduleOptions) { buildNodePath(node, option, moduleOptions) {
// //
@ -441,6 +460,7 @@
this.form.priority = ''; this.form.priority = '';
this.form.prerequisite = ''; this.form.prerequisite = '';
this.form.remark = ''; this.form.remark = '';
this.form.testId = '';
this.form.steps = [{ this.form.steps = [{
num: 1 , num: 1 ,
desc: '', desc: '',

View File

@ -85,7 +85,22 @@
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row v-if="testCase.method == 'auto' && testCase.testId">
<el-col class="test-detail" :span="20" :offset="1">
<el-tabs type="border-card">
<el-tab-pane :label="$t('test_track.plan_view.test_detail')">
<ms-api-test-config v-if="testCase.type == 'api'"/>
<edit-performance-test-plan v-if="testCase.type == 'performance'"/>
</el-tab-pane>
<el-tab-pane :label="$t('test_track.plan_view.test_result')">
<ms-api-report-view v-if="testCase.type == 'api'"/>
<performance-report-view v-if="testCase.type == 'performance'"/>
</el-tab-pane>
</el-tabs>
</el-col>
</el-row>
<el-row v-if="testCase.method && testCase.method != 'auto'">
<el-col :span="20" :offset="1"> <el-col :span="20" :offset="1">
<div> <div>
<span class="cast_label">{{$t('test_track.case.steps')}}</span> <span class="cast_label">{{$t('test_track.case.steps')}}</span>
@ -184,10 +199,16 @@
<script> <script>
import TestPlanTestCaseStatusButton from '../../common/TestPlanTestCaseStatusButton'; import TestPlanTestCaseStatusButton from '../../common/TestPlanTestCaseStatusButton';
import ClassicEditor from '@ckeditor/ckeditor5-build-classic'; import ClassicEditor from '@ckeditor/ckeditor5-build-classic';
import MsApiTestConfig from "../../../../api/test/ApiTestConfig";
import MsApiReportView from "../../../../api/report/ApiReportView";
import EditPerformanceTestPlan from "../../../../performance/test/EditPerformanceTestPlan";
import PerformanceReportView from "../../../../performance/report/PerformanceReportView";
export default { export default {
name: "TestPlanTestCaseEdit", name: "TestPlanTestCaseEdit",
components: {TestPlanTestCaseStatusButton}, components: {
PerformanceReportView,
EditPerformanceTestPlan, MsApiReportView, MsApiTestConfig, TestPlanTestCaseStatusButton},
data() { data() {
return { return {
result: {}, result: {},
@ -196,6 +217,7 @@
index: 0, index: 0,
testCases: [], testCases: [],
editor: ClassicEditor, editor: ClassicEditor,
test: {}
}; };
}, },
props: { props: {
@ -290,10 +312,18 @@
if (this.testCases[i].id === testCase.id) { if (this.testCases[i].id === testCase.id) {
this.index = i; this.index = i;
this.getTestCase(i); this.getTestCase(i);
this.getRelatedTest();
} }
} }
}); });
}, },
getRelatedTest() {
if (this.testCase.method == 'auto' && this.testCase.testId) {
this.$get('/' + this.testCase.type + '/get/' + this.testCase.testId, response => {
this.test = response.data;
});
}
},
issuesChange() { issuesChange() {
if (this.testCase.issues.hasIssues) { if (this.testCase.issues.hasIssues) {
let desc = this.addPLabel('[' + this.$t('test_track.plan_view.operate_step') + ']'); let desc = this.addPLabel('[' + this.$t('test_track.plan_view.operate_step') + ']');
@ -343,7 +373,7 @@
text-align: right; text-align: right;
} }
.el-col { .el-col:not(.test-detail){
line-height: 50px; line-height: 50px;
} }

View File

@ -489,6 +489,7 @@ export default {
result_statistics_chart: "Result statistics chart", result_statistics_chart: "Result statistics chart",
create_template: "Create template", create_template: "Create template",
report_template: "Report template", report_template: "Report template",
test_detail: "Test detail",
} }
}, },
test_resource_pool: { test_resource_pool: {

View File

@ -486,6 +486,7 @@ export default {
result_statistics_chart: "测试结果统计图", result_statistics_chart: "测试结果统计图",
create_template: "新建模版", create_template: "新建模版",
report_template: "测试报告模版", report_template: "测试报告模版",
test_detail: "测试详情",
} }
}, },
test_resource_pool: { test_resource_pool: {

View File

@ -488,6 +488,7 @@ export default {
result_statistics_chart: "測試結果統計圖", result_statistics_chart: "測試結果統計圖",
create_template: "新建模版", create_template: "新建模版",
report_template: "測試報告模版", report_template: "測試報告模版",
test_detail: "測試詳情",
} }
}, },
test_resource_pool: { test_resource_pool: {