fix(接口测试): 脚本断言失败,状态任然显示成功

--bug=1046899 --user=陈建星 [接口测试]github#332222个全局断言成功+1个接口用例本身断言失败 = 最终结果为成功 https://www.tapd.cn/55049933/s/1583998
This commit is contained in:
AgAngle 2024-09-23 19:54:13 +08:00 committed by Craftsman
parent bc1455314c
commit 759d067fd7
1 changed files with 17 additions and 5 deletions

View File

@ -78,11 +78,23 @@ public class MsCommonElementConverter extends AbstractJmeterElementConverter<MsC
} }
} }
assertionConfig.getAssertions() // 将状态码断言放最前面否则会影响脚本断言的效果即使脚本断言失败总状态还是显示成功
.forEach(assertion -> { List<MsAssertion> sortAssertions = new ArrayList<>(assertions.size());
assertion.setProjectId(element.getProjectId()); assertions.forEach(item -> {
AssertionConverterFactory.getConverter(assertion.getClass()).parse(tree, assertion, config, isIgnoreAssertStatus(assertions)); if (item instanceof MsResponseCodeAssertion) {
}); sortAssertions.add(item);
}
});
assertions.forEach(item -> {
if (!(item instanceof MsResponseCodeAssertion)) {
sortAssertions.add(item);
}
});
sortAssertions
.forEach(assertion -> {
assertion.setProjectId(element.getProjectId());
AssertionConverterFactory.getConverter(assertion.getClass()).parse(tree, assertion, config, isIgnoreAssertStatus(assertions));
});
} }
/** /**