fix (测试计划): 计划场景串行按照顺序执行
--bug=1008129 --user=赵勇 【测试计划】批量执行场景用例,没有按列表顺序执行 https://www.tapd.cn/55049933/s/1072114
This commit is contained in:
parent
321e1462e1
commit
933f53505f
|
@ -582,8 +582,10 @@ public class ApiDefinitionService {
|
||||||
} else {
|
} else {
|
||||||
test.setTags("");
|
test.setTags("");
|
||||||
}
|
}
|
||||||
apiDefinitionMapper.insert(test);
|
if (apiDefinitionMapper.selectByPrimaryKey(test.getId()) == null) {
|
||||||
saveFollows(test.getId(), request.getFollows());
|
apiDefinitionMapper.insert(test);
|
||||||
|
saveFollows(test.getId(), request.getFollows());
|
||||||
|
}
|
||||||
return test;
|
return test;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -188,18 +188,18 @@ public class TestPlanScenarioCaseService {
|
||||||
});
|
});
|
||||||
List<TestPlanApiScenario> testPlanApiScenarioList = extTestPlanScenarioCaseMapper.selectByIds(idStr.toString().substring(0, idStr.toString().length() - 1), "\"" + org.apache.commons.lang3.StringUtils.join(testPlanScenarioRequest.getPlanCaseIds(), ",") + "\"");
|
List<TestPlanApiScenario> testPlanApiScenarioList = extTestPlanScenarioCaseMapper.selectByIds(idStr.toString().substring(0, idStr.toString().length() - 1), "\"" + org.apache.commons.lang3.StringUtils.join(testPlanScenarioRequest.getPlanCaseIds(), ",") + "\"");
|
||||||
List<String> scenarioIds = new ArrayList<>();
|
List<String> scenarioIds = new ArrayList<>();
|
||||||
Map<String, String> scenarioIdApiScarionMap = new HashMap<>();
|
Map<String, String> scenarioPlanIdMap = new LinkedHashMap<>();
|
||||||
for (TestPlanApiScenario apiScenario : testPlanApiScenarioList) {
|
for (TestPlanApiScenario apiScenario : testPlanApiScenarioList) {
|
||||||
scenarioIds.add(apiScenario.getApiScenarioId());
|
scenarioIds.add(apiScenario.getApiScenarioId());
|
||||||
scenarioIdApiScarionMap.put(apiScenario.getId(), apiScenario.getApiScenarioId());
|
scenarioPlanIdMap.put(apiScenario.getId(), apiScenario.getApiScenarioId());
|
||||||
}
|
}
|
||||||
if (scenarioIdApiScarionMap.isEmpty()) {
|
if (scenarioPlanIdMap.isEmpty()) {
|
||||||
MSException.throwException("未找到执行场景!");
|
MSException.throwException("未找到执行场景!");
|
||||||
}
|
}
|
||||||
RunScenarioRequest request = new RunScenarioRequest();
|
RunScenarioRequest request = new RunScenarioRequest();
|
||||||
request.setIds(scenarioIds);
|
request.setIds(scenarioIds);
|
||||||
request.setReportId(testPlanScenarioRequest.getId());
|
request.setReportId(testPlanScenarioRequest.getId());
|
||||||
request.setScenarioTestPlanIdMap(scenarioIdApiScarionMap);
|
request.setScenarioTestPlanIdMap(scenarioPlanIdMap);
|
||||||
request.setRunMode(ApiRunMode.SCENARIO_PLAN.name());
|
request.setRunMode(ApiRunMode.SCENARIO_PLAN.name());
|
||||||
request.setId(testPlanScenarioRequest.getId());
|
request.setId(testPlanScenarioRequest.getId());
|
||||||
request.setExecuteType(ExecuteType.Saved.name());
|
request.setExecuteType(ExecuteType.Saved.name());
|
||||||
|
|
|
@ -50,10 +50,10 @@
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="16">
|
<el-col :span="16">
|
||||||
<div class="tag-item" @click.stop>
|
<div class="tag-item" @click.stop>
|
||||||
<el-tooltip :content="$t('commons.follow')" placement="bottom" effect="dark" v-if="!showFollow">
|
<el-tooltip :content="$t('commons.follow')" placement="bottom" effect="dark" v-if="!showFollow">
|
||||||
<i class="el-icon-star-off" style="color: #783987; font-size: 25px; margin-top: 2px; margin-right: 15px;cursor: pointer " @click="saveFollow"/>
|
<i class="el-icon-star-off" style="color: #783987; font-size: 25px; margin-top: 2px; margin-right: 15px;cursor: pointer " @click="saveFollow"/>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-tooltip :content="$t('commons.cancel')" placement="bottom" effect="dark" v-if="showFollow">
|
<el-tooltip :content="$t('commons.cancel')" placement="bottom" effect="dark" v-if="showFollow">
|
||||||
<i class="el-icon-star-on" style="color: #783987; font-size: 28px; margin-top: 2px; margin-right: 15px;cursor: pointer " @click="saveFollow" v-if="showFollow"/>
|
<i class="el-icon-star-on" style="color: #783987; font-size: 28px; margin-top: 2px; margin-right: 15px;cursor: pointer " @click="saveFollow" v-if="showFollow"/>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</div>
|
</div>
|
||||||
|
@ -128,6 +128,7 @@
|
||||||
<!-- 保存操作 -->
|
<!-- 保存操作 -->
|
||||||
<el-button type="primary" size="small" style="margin: 20px; float: right" @click="saveTestCase(apiCase)"
|
<el-button type="primary" size="small" style="margin: 20px; float: right" @click="saveTestCase(apiCase)"
|
||||||
v-if="type!=='detail'"
|
v-if="type!=='detail'"
|
||||||
|
v-prevent-re-click
|
||||||
v-permission="['PROJECT_API_DEFINITION:READ+EDIT_CASE']">
|
v-permission="['PROJECT_API_DEFINITION:READ+EDIT_CASE']">
|
||||||
{{ $t('commons.save') }}
|
{{ $t('commons.save') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
|
@ -218,8 +219,9 @@ export default {
|
||||||
isShowInput: false,
|
isShowInput: false,
|
||||||
methodColorMap: new Map(API_METHOD_COLOUR),
|
methodColorMap: new Map(API_METHOD_COLOUR),
|
||||||
saveLoading: false,
|
saveLoading: false,
|
||||||
showFollow:false,
|
showFollow: false,
|
||||||
beforeRequest: {},
|
beforeRequest: {},
|
||||||
|
compare: [],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
@ -267,7 +269,7 @@ export default {
|
||||||
this.$get('/api/testcase/follow/' + this.apiCase.id, response => {
|
this.$get('/api/testcase/follow/' + this.apiCase.id, response => {
|
||||||
this.apiCase.follows = response.data;
|
this.apiCase.follows = response.data;
|
||||||
for (let i = 0; i < response.data.length; i++) {
|
for (let i = 0; i < response.data.length; i++) {
|
||||||
if(response.data[i]===this.currentUser().id){
|
if (response.data[i] === this.currentUser().id) {
|
||||||
this.showFollow = true;
|
this.showFollow = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -449,6 +451,7 @@ export default {
|
||||||
row.id = data.id;
|
row.id = data.id;
|
||||||
row.createTime = data.createTime;
|
row.createTime = data.createTime;
|
||||||
row.updateTime = data.updateTime;
|
row.updateTime = data.updateTime;
|
||||||
|
this.compare = [];
|
||||||
if (!row.message) {
|
if (!row.message) {
|
||||||
this.$success(this.$t('commons.save_success'));
|
this.$success(this.$t('commons.save_success'));
|
||||||
this.reload();
|
this.reload();
|
||||||
|
@ -463,11 +466,14 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
saveTestCase(row, hideAlert) {
|
saveTestCase(row, hideAlert) {
|
||||||
if (this.api.saved) {
|
if (this.compare.indexOf(row.id) === -1) {
|
||||||
this.addModule(row);
|
this.compare.push(row.id);
|
||||||
} else {
|
if (this.api.saved) {
|
||||||
this.api.source = "editCase";
|
this.addModule(row);
|
||||||
this.saveCase(row, hideAlert);
|
} else {
|
||||||
|
this.api.source = "editCase";
|
||||||
|
this.saveCase(row, hideAlert);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
showInput(row) {
|
showInput(row) {
|
||||||
|
@ -508,28 +514,28 @@ export default {
|
||||||
showHistory(id) {
|
showHistory(id) {
|
||||||
this.$emit("showHistory", id);
|
this.$emit("showHistory", id);
|
||||||
},
|
},
|
||||||
saveFollow(){
|
saveFollow() {
|
||||||
if(this.showFollow){
|
if (this.showFollow) {
|
||||||
this.showFollow = false;
|
this.showFollow = false;
|
||||||
for (let i = 0; i < this.apiCase.follows.length; i++) {
|
for (let i = 0; i < this.apiCase.follows.length; i++) {
|
||||||
if(this.apiCase.follows[i]===this.currentUser().id){
|
if (this.apiCase.follows[i] === this.currentUser().id) {
|
||||||
this.apiCase.follows.splice(i,1)
|
this.apiCase.follows.splice(i, 1)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( this.apiCase.id){
|
if (this.apiCase.id) {
|
||||||
this.$post("/api/testcase/update/follows/"+this.apiCase.id, this.apiCase.follows,() => {
|
this.$post("/api/testcase/update/follows/" + this.apiCase.id, this.apiCase.follows, () => {
|
||||||
this.$success(this.$t('commons.cancel_follow_success'));
|
this.$success(this.$t('commons.cancel_follow_success'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
this.showFollow = true;
|
this.showFollow = true;
|
||||||
if(!this.apiCase.follows){
|
if (!this.apiCase.follows) {
|
||||||
this.apiCase.follows = [];
|
this.apiCase.follows = [];
|
||||||
}
|
}
|
||||||
this.apiCase.follows.push(this.currentUser().id)
|
this.apiCase.follows.push(this.currentUser().id)
|
||||||
if( this.apiCase.id){
|
if (this.apiCase.id) {
|
||||||
this.$post("/api/testcase/update/follows/"+this.apiCase.id, this.apiCase.follows,() => {
|
this.$post("/api/testcase/update/follows/" + this.apiCase.id, this.apiCase.follows, () => {
|
||||||
this.$success(this.$t('commons.follow_success'));
|
this.$success(this.$t('commons.follow_success'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue