feat(误报库): 修复响应码不是200且误报库未匹配到的情况下整体请求判断为通过的缺陷
修复响应码不是200且误报库未匹配到的情况下整体请求判断为通过的缺陷
This commit is contained in:
parent
a1cdc50d81
commit
3bd751f23b
|
@ -26,23 +26,25 @@ public class ErrorReportLibraryUtil {
|
|||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(errorReportAssertionList)) {
|
||||
List<ResponseAssertionResult> removeList = new ArrayList<>();
|
||||
List<ResponseAssertionResult> unMatchErrorReportAssertions = new ArrayList<>();
|
||||
for (ResponseAssertionResult assertion : errorReportAssertionList) {
|
||||
if (assertion.isPass()) {
|
||||
String errorCode = StringUtils.substring(assertion.getContent(), ERROR_CODE_START.length());
|
||||
returnDTO.getErrorCodeList().add(errorCode);
|
||||
} else {
|
||||
removeList.add(assertion);
|
||||
unMatchErrorReportAssertions.add(assertion);
|
||||
}
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(removeList)) {
|
||||
if (result.getError() > 0) {
|
||||
if (CollectionUtils.isNotEmpty(unMatchErrorReportAssertions)) {
|
||||
// 未被误报断言匹配到的结果,清除该请求的误报断言记录,并将断言涉及到的统计结果恢复正常
|
||||
if (result.getResponseResult() != null
|
||||
&& StringUtils.equalsIgnoreCase(result.getResponseResult().getResponseCode(), "200")
|
||||
&& result.getError() > 0) {
|
||||
result.setError(result.getError() - 1);
|
||||
}
|
||||
result.setTotalAssertions(result.getTotalAssertions() - removeList.size());
|
||||
result.getResponseResult().getAssertions().removeAll(removeList);
|
||||
//修改由于误报断言导致的执行结果
|
||||
result.setTotalAssertions(result.getTotalAssertions() - unMatchErrorReportAssertions.size());
|
||||
result.getResponseResult().getAssertions().removeAll(unMatchErrorReportAssertions);
|
||||
if (result.getError() == 0 && !result.isSuccess()) {
|
||||
result.setSuccess(true);
|
||||
}
|
||||
|
|
|
@ -21,6 +21,13 @@
|
|||
<ms-scenario-results v-on:requestResult="requestResult" :console="content.console"
|
||||
:treeData="fullTreeNodes" ref="failsTree"/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane name="errorReport" v-if="content.errorCode > 0">
|
||||
<template slot="label">
|
||||
<span class="fail">{{ $t('error_report_library.option.name') }}</span>
|
||||
</template>
|
||||
<ms-scenario-results v-on:requestResult="requestResult" :console="content.console"
|
||||
:treeData="fullTreeNodes" ref="errorReportTree"/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane name="console">
|
||||
<template slot="label">
|
||||
<span class="console">{{ $t('api_test.definition.request.console') }}</span>
|
||||
|
@ -119,6 +126,8 @@ export default {
|
|||
filter(index) {
|
||||
if (index === "1") {
|
||||
this.$refs.failsTree.filter(index);
|
||||
} else if (this.activeName === "errorReport") {
|
||||
this.$refs.errorReportTree.filter("errorReport");
|
||||
}
|
||||
},
|
||||
init() {
|
||||
|
|
|
@ -43,8 +43,16 @@ export default {
|
|||
}
|
||||
if (!value) return true;
|
||||
if (data.value) {
|
||||
if (value === 'errorReport') {
|
||||
if (data.errorCode && data.errorCode !== "") {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (!data.errorCode || data.errorCode === "") {
|
||||
return data.value.error > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
filter(val) {
|
||||
|
|
Loading…
Reference in New Issue