fix(接口测试): 脚本断言失败,状态任然显示成功
--bug=1046899 --user=陈建星 [接口测试]github#332222个全局断言成功+1个接口用例本身断言失败 = 最终结果为成功 https://www.tapd.cn/55049933/s/1583998
This commit is contained in:
parent
bc1455314c
commit
759d067fd7
|
@ -78,11 +78,23 @@ public class MsCommonElementConverter extends AbstractJmeterElementConverter<MsC
|
|||
}
|
||||
}
|
||||
|
||||
assertionConfig.getAssertions()
|
||||
.forEach(assertion -> {
|
||||
assertion.setProjectId(element.getProjectId());
|
||||
AssertionConverterFactory.getConverter(assertion.getClass()).parse(tree, assertion, config, isIgnoreAssertStatus(assertions));
|
||||
});
|
||||
// 将状态码断言放最前面,否则会影响脚本断言的效果,即使脚本断言失败,总状态还是显示成功
|
||||
List<MsAssertion> sortAssertions = new ArrayList<>(assertions.size());
|
||||
assertions.forEach(item -> {
|
||||
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));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue