fix:【github】测试跟踪 新建用例关联接口测试

This commit is contained in:
wenyann 2021-07-09 11:34:50 +08:00 committed by 刘瑞斌
parent d4fec7b67d
commit 422aaf55b1
3 changed files with 66 additions and 23 deletions

View File

@ -1066,7 +1066,7 @@ public class TestCaseService {
TestCaseTest test = new TestCaseTest();
selecteds.forEach(id -> {
test.setTestType(id.get(0));
test.setTestId(id.get(1));
test.setTestId(id.get(id.size() - 1));
test.setTestCaseId(request.getId());
test.setCreateTime(System.currentTimeMillis());
test.setUpdateTime(System.currentTimeMillis());
@ -1113,7 +1113,7 @@ public class TestCaseService {
TestCaseTest test = new TestCaseTest();
selecteds.forEach(id -> {
test.setTestType(id.get(0));
test.setTestId(id.get(1));
test.setTestId(id.get(id.size() - 1));
test.setCreateTime(System.currentTimeMillis());
test.setUpdateTime(System.currentTimeMillis());
test.setTestCaseId(request.getId());

View File

@ -524,6 +524,7 @@ public class TestPlanService {
if (StringUtils.equals(l.getTestType(), TestCaseStatus.automation.name())) {
TestPlanApiScenario t = new TestPlanApiScenario();
ApiScenarioWithBLOBs testPlanApiScenario = apiScenarioMapper.selectByPrimaryKey(l.getTestId());
if (testPlanApiScenario != null) {
t.setId(UUID.randomUUID().toString());
t.setTestPlanId(request.getPlanId());
t.setApiScenarioId(l.getTestId());
@ -539,6 +540,8 @@ public class TestPlanService {
testPlanApiScenarioMapper.insert(t);
}
}
}
});
});
}

View File

@ -15,11 +15,12 @@
</span>
</el-col>
<el-col v-else :span="7" style="margin-top: 10px;">
<el-form-item :label="$t('test_track.case.relate_test')" :label-width="labelWidth">
<el-cascader :options="sysList" filterable :placeholder="$t('test_track.case.please_select_relate_test')" show-all-levels
<el-form-item :label="$t('test_track.case.relate_test')">
<el-cascader :options="sysList" filterable :placeholder="$t('test_track.case.please_select_relate_test')"
show-all-levels
v-model="form.selected" :props="props"
:disabled="readOnly"
class="ms-case" ref="cascade"></el-cascader>
ref="cascade"></el-cascader>
</el-form-item>
</el-col>
</el-tab-pane>
@ -293,14 +294,48 @@ export default {
this.form.type = val;
this.testOptions = [];
let url = '';
if (this.form.type === 'testcase' || this.form.type === 'automation') {
if (this.form.type === 'testcase') {
url = '/api/' + this.form.type + '/list/' + this.projectId;
} else if (this.form.type === 'performance' || this.form.type === 'api') {
url = '/' + this.form.type + '/list/' + this.projectId;
}
if (!url) {
return;
}
this.buildValue(url);
} else if (this.form.type === 'performance' || this.form.type === 'api') {
url = '/' + this.form.type + '/list/' + this.projectId;
if (!url) {
return;
}
this.buildValue(url);
} else if (this.form.type === 'automation') {
//url = '/api/' + this.form.type + '/list/' + this.projectId;
url = '/api/automation/module/list/' + this.projectId;
if (!url) {
return;
}
this.result.loading = true;
return new Promise((resolve, reject) => {
this.$get("/api/automation/module/list/" + this.projectId, response => {
if (response.data != undefined && response.data != null) {
this.buildTreeValue(response.data);
}
this.result.loading = false;
resolve(response.data);
});
});
}
},
buildTreeValue(list) {
list.forEach(item => {
item.value = item.id,
item.label = item.name,
item.leaf = true;
if (item.children) {
this.buildTreeValue(item.children);
}
});
},
buildValue(url) {
this.result.loading = true;
return new Promise((resolve, reject) => {
this.$get(url).then(res => {
@ -315,7 +350,7 @@ export default {
reject(err);
});
});
},
}
}
};
</script>
@ -333,4 +368,9 @@ export default {
.remark-item {
padding: 0px 15px;
}
.el-cascader >>> .el-input {
cursor: pointer;
width: 300px;
}
</style>