fix(接口测试): 如果场景中认为添加进了全局前后置脚本并且步骤名称也符合全局前后置脚本的命名规范,那么报告中应该显示相关步骤。
--bug=1023228 --user=宋天阳 【接口测试】导入附件中的脚本执行,步骤1和7执行了,但是报告里显示的是pending https://www.tapd.cn/55049933/s/1336950
This commit is contained in:
parent
3bff069867
commit
6260f99bbd
|
@ -567,8 +567,6 @@ public class ApiScenarioReportStructureService {
|
||||||
if (CollectionUtils.isNotEmpty(reportStructureWithBLOBs) && CollectionUtils.isNotEmpty(reportResults)) {
|
if (CollectionUtils.isNotEmpty(reportStructureWithBLOBs) && CollectionUtils.isNotEmpty(reportResults)) {
|
||||||
ApiScenarioReportStructureWithBLOBs scenarioReportStructure = reportStructureWithBLOBs.get(0);
|
ApiScenarioReportStructureWithBLOBs scenarioReportStructure = reportStructureWithBLOBs.get(0);
|
||||||
List<StepTreeDTO> stepList = JSON.parseArray(new String(scenarioReportStructure.getResourceTree(), StandardCharsets.UTF_8), StepTreeDTO.class);
|
List<StepTreeDTO> stepList = JSON.parseArray(new String(scenarioReportStructure.getResourceTree(), StandardCharsets.UTF_8), StepTreeDTO.class);
|
||||||
//判断是否含有全局前后置脚本,如果有的话需要将脚本内容添加到stepDTO中
|
|
||||||
reportResults = this.filterProcessResult(reportResults);
|
|
||||||
|
|
||||||
reportDTO.setTotal(reportResults.size());
|
reportDTO.setTotal(reportResults.size());
|
||||||
reportDTO.setError(reportResults.stream().filter(e -> StringUtils.equals(e.getStatus(), ApiReportStatus.ERROR.name())).collect(Collectors.toList()).size());
|
reportDTO.setError(reportResults.stream().filter(e -> StringUtils.equals(e.getStatus(), ApiReportStatus.ERROR.name())).collect(Collectors.toList()).size());
|
||||||
|
|
|
@ -224,6 +224,7 @@ public class JMeterBase {
|
||||||
String evnStr = result.getResponseDataAsString();
|
String evnStr = result.getResponseDataAsString();
|
||||||
environmentList.add(evnStr);
|
environmentList.add(evnStr);
|
||||||
} else {
|
} else {
|
||||||
|
//检查是否有关系到最终执行结果的全局前后置脚本。
|
||||||
boolean resultNotFilterOut = ListenerUtil.checkResultIsNotFilterOut(requestResult);
|
boolean resultNotFilterOut = ListenerUtil.checkResultIsNotFilterOut(requestResult);
|
||||||
if (resultNotFilterOut) {
|
if (resultNotFilterOut) {
|
||||||
if (StringUtils.isNotEmpty(requestResult.getName()) && requestResult.getName().startsWith("Transaction=")) {
|
if (StringUtils.isNotEmpty(requestResult.getName()) && requestResult.getName().startsWith("Transaction=")) {
|
||||||
|
@ -231,6 +232,11 @@ public class JMeterBase {
|
||||||
} else {
|
} else {
|
||||||
requestResults.add(requestResult);
|
requestResults.add(requestResult);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
//全局前后置脚本的执行结果不影响场景执行结果,默认它们都是执行成功的
|
||||||
|
requestResult.setError(0);
|
||||||
|
requestResult.setSuccess(true);
|
||||||
|
requestResults.add(requestResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue