fix(接口场景): 修复接口场景调试时控制台为空的问题

修复接口场景调试时控制台为空的问题
This commit is contained in:
song-tianyang 2022-01-18 18:08:53 +08:00 committed by fit2-zhao
parent 25ff9fa79d
commit 459983e597
1 changed files with 9 additions and 4 deletions

View File

@ -162,18 +162,23 @@ public class MsDebugListener extends AbstractListenerElement implements SampleLi
if (StringUtils.isNotEmpty(requestResult.getName()) && requestResult.getName().startsWith("Transaction=")) {
requestResult.getSubRequestResults().forEach(transactionResult -> {
transactionResult.getResponseResult().setConsole(console);
dto.setContent("result_" + JSON.toJSONString(transactionResult));
WebSocketUtils.sendMessageSingle(dto);
});
} else {
//解析误报内容
JSONObject requestResultObject = JSONObject.parseObject(JSON.toJSONString(requestResult));
ErrorReportLibraryParseDTO errorCodeDTO = ErrorReportLibraryUtil.parseAssertions(requestResult);
ErrorReportLibraryParseDTO errorCodeDTO = ErrorReportLibraryUtil.parseAssertions(transactionResult);
JSONObject requestResultObject = JSONObject.parseObject(JSON.toJSONString(transactionResult));
if(CollectionUtils.isNotEmpty(errorCodeDTO.getErrorCodeList())){
requestResultObject.put("errorReportResult",errorCodeDTO.getErrorCodeStr());
}
dto.setContent("result_" + JSON.toJSONString(requestResultObject));
WebSocketUtils.sendMessageSingle(dto);
});
} else {
requestResult.getResponseResult().setConsole(console);
//解析误报内容
ErrorReportLibraryParseDTO errorCodeDTO = ErrorReportLibraryUtil.parseAssertions(requestResult);
JSONObject requestResultObject = JSONObject.parseObject(JSON.toJSONString(requestResult));
if(CollectionUtils.isNotEmpty(errorCodeDTO.getErrorCodeList())){
requestResultObject.put("errorReportResult",errorCodeDTO.getErrorCodeStr());
}
dto.setContent("result_" + JSON.toJSONString(requestResultObject));
WebSocketUtils.sendMessageSingle(dto);
}