fix(接口测试): 修复多层嵌套事物控制器执行状态显示问题

--bug=1026649 --user=赵勇 【接口测试】github#24702,场景中事务控制器下请求报错,但是事务控制器显示成功 https://www.tapd.cn/55049933/s/1385660

Signed-off-by: fit2-zhao <yong.zhao@fit2cloud.com>
This commit is contained in:
fit2-zhao 2023-06-25 17:34:14 +08:00 committed by fit2-zhao
parent 8ee491dd84
commit dcf7dbbb8a
3 changed files with 17 additions and 13 deletions

View File

@ -377,7 +377,7 @@ public class MsHashTreeService {
Map<String, Boolean> indexKeyMap = new HashMap<>();
StringBuilder builder = new StringBuilder(parentIndex);
if (element.has(ENABLE) && element.has(ID) && element.has(INDEX)) {
builder.append("_").append(element.getString(INDEX));
builder.append("_").append(element.optString(INDEX));
String key = StringUtils.join(element.optString(ID), builder.toString());
indexKeyMap.put(key, element.optBoolean(ENABLE));
}
@ -435,7 +435,8 @@ public class MsHashTreeService {
}
private void setCaseEnable(JSONObject element, Map<String, Boolean> keyMap, String parentIndex) {
if (element.has(ENABLE) && BooleanUtils.isFalse(element.optBoolean(ENABLE))) {
if (element.has(ENABLE) && BooleanUtils.isFalse(element.optBoolean(ENABLE))
&& StringUtils.equals(element.optString(REFERENCED),REF)) {
element.put(ENABLE, false);
element.put(REF_ENABLE, true);
} else {

View File

@ -128,7 +128,6 @@
<el-col :span="13">
<env-popover
:disabled="scenarioDefinition.length < 1"
:env-map="projectEnvMap"
:project-ids="projectIds"
:result="envResult"
@ -151,6 +150,7 @@
@click="runDebug"
class="ms-message-right"
size="mini"
:disabled="scenarioDefinition.length < 1"
@command="handleCommand"
v-permission="[
'PROJECT_API_SCENARIO:READ+DEBUG',
@ -1114,15 +1114,14 @@ export default {
}
},
evaluationParent(node, status) {
if (!node.data.code) {
node.data.code = 'SUCCESS';
if(node.data.code === "ERROR") {
return;
}
if (node.data.code ==='SUCCESS' && status && status === 'SUCCESS') {
node.data.code = 'SUCCESS';
if (node.data.code === 'FAKE_ERROR') {
return;
}
if ((node.data.code ==='SUCCESS' ||
node.data.code === 'FAKE_ERROR') &&
status && status === 'FAKE_ERROR') {
node.data.code = status ? 'SUCCESS' : 'ERROR';
if (status === 'FAKE_ERROR') {
node.data.code = 'FAKE_ERROR';
}
if (status && status === 'ERROR') {
@ -1139,6 +1138,7 @@ export default {
let id = item.data.id || item.data.resourceId;
if (id + '_' + item.data.parentIndex === resourceId) {
item.data.testing = false;
item.data.code = status ? "SUCCESS" : "ERROR";
this.evaluationParent(item.parent, status);
}
if (item.childNodes && item.childNodes.length > 0) {

View File

@ -46,13 +46,11 @@
</div>
</el-col>
<el-col :span="12">
<el-checkbox v-model="cookieShare" @change="setCookieShare">共享cookie</el-checkbox>
<el-checkbox v-model="cookieShare" @change="setCookieShare">{{ $t('api_test.scenario.share_cookie') }}</el-checkbox>
<el-checkbox v-model="sampleError" @change="setOnSampleError" style="margin-right: 10px">
{{ $t('commons.failure_continues') }}
</el-checkbox>
<env-popover
:disabled="scenarioDefinition.length < 1"
:isReadOnly="scenarioDefinition.length < 1"
:env-map="projectEnvMap"
:project-ids="projectIds"
@setProjectEnvMap="setProjectEnvMap"
@ -72,6 +70,7 @@
@click="debugScenario"
style="margin: 0px 10px 0px"
size="mini"
:disabled="scenarioDefinition.length < 1"
@command="handleCommand"
v-show="!debugLoading">
{{ $t('api_test.request.debug') }}
@ -800,6 +799,9 @@ export default {
});
},
debugScenario() {
if(this.scenarioDefinition.length < 1){
return;
}
this.debugLoading = true;
this.$emit('runDebug');
},
@ -1493,4 +1495,5 @@ export default {
white-space: nowrap;
width: 120px;
}
</style>