fix(接口测试): 符合误报要求的接口案例执行时将状态码的颜色与误报颜色进行匹配

--bug=1009864 --user=宋天阳 【误报库】接口执行结果为误报时,状态码颜色不对
https://www.tapd.cn/55049933/s/1096230
This commit is contained in:
song-tianyang 2022-01-22 15:23:39 +08:00 committed by song-tianyang
parent ac142ee15f
commit 0899186dc6
5 changed files with 43 additions and 35 deletions

View File

@ -211,13 +211,14 @@ public class ApiDefinitionExecResultService {
for (RequestResult item : requestResults) { for (RequestResult item : requestResults) {
if (!StringUtils.startsWithAny(item.getName(), "PRE_PROCESSOR_ENV_", "POST_PROCESSOR_ENV_")) { if (!StringUtils.startsWithAny(item.getName(), "PRE_PROCESSOR_ENV_", "POST_PROCESSOR_ENV_")) {
//对响应内容进行进一步解析如果有附加信息比如误报库信息则根据附加信息内的数据进行其他判读
RequestResultExpandDTO expandDTO = ResponseUtil.parseByRequestResult(item);
ApiDefinitionExecResult reportResult = this.save(item, dto.getReportId(), dto.getConsole(), countExpectProcessResultCount, dto.getRunMode(), dto.getTestId(), isFirst); ApiDefinitionExecResult reportResult = this.save(item, dto.getReportId(), dto.getConsole(), countExpectProcessResultCount, dto.getRunMode(), dto.getTestId(), isFirst);
String status = item.isSuccess() ? "success" : "error"; String status = item.isSuccess() ? "success" : "error";
if (reportResult != null) { if (reportResult != null) {
status = reportResult.getStatus(); status = reportResult.getStatus();
} }
//对响应内容进行进一步解析如果有附加信息比如误报库信息则根据附加信息内的数据进行其他判读
RequestResultExpandDTO expandDTO = ResponseUtil.parseByRequestResult(item);
if (MapUtils.isNotEmpty(expandDTO.getAttachInfoMap())) { if (MapUtils.isNotEmpty(expandDTO.getAttachInfoMap())) {
status = expandDTO.getStatus(); status = expandDTO.getStatus();
} }
@ -345,11 +346,9 @@ public class ApiDefinitionExecResultService {
if (StringUtils.isEmpty(saveResult.getActuator())) { if (StringUtils.isEmpty(saveResult.getActuator())) {
saveResult.setActuator("LOCAL"); saveResult.setActuator("LOCAL");
} }
String status = item.isSuccess() ? ExecuteResult.success.name() : ExecuteResult.error.name();
//对响应内容进行进一步解析如果有附加信息比如误报库信息则根据附加信息内的数据进行其他判读 //对响应内容进行进一步解析如果有附加信息比如误报库信息则根据附加信息内的数据进行其他判读
RequestResultExpandDTO expandDTO = ResponseUtil.parseByRequestResult(item); RequestResultExpandDTO expandDTO = ResponseUtil.parseByRequestResult(item);
String status = item.isSuccess() ? ExecuteResult.success.name() : ExecuteResult.error.name();
if (MapUtils.isNotEmpty(expandDTO.getAttachInfoMap())) { if (MapUtils.isNotEmpty(expandDTO.getAttachInfoMap())) {
status = expandDTO.getStatus(); status = expandDTO.getStatus();
saveResult.setContent(JSON.toJSONString(expandDTO)); saveResult.setContent(JSON.toJSONString(expandDTO));

View File

@ -107,7 +107,7 @@ public class ShareInfoService {
JSONArray headArr = requestObj.getJSONArray("headers"); JSONArray headArr = requestObj.getJSONArray("headers");
for (int index = 0; index < headArr.size(); index++) { for (int index = 0; index < headArr.size(); index++) {
JSONObject headObj = headArr.getJSONObject(index); JSONObject headObj = headArr.getJSONObject(index);
if (headObj.containsKey("name") && headObj.containsKey("value")) { if (headObj != null && headObj.containsKey("name") && headObj.containsKey("value")) {
requestHeadDataArr.add(headObj); requestHeadDataArr.add(headObj);
} }
} }
@ -417,6 +417,7 @@ public class ShareInfoService {
/** /**
* 生成分享连接 * 生成分享连接
* 如果该数据有连接则返回已有的连接不做有效期判断 * 如果该数据有连接则返回已有的连接不做有效期判断
*
* @param request * @param request
* @return * @return
*/ */
@ -504,6 +505,7 @@ public class ShareInfoService {
* 若在当前类中调用请使用如下方式调用否则该方法的事务注解不生效 * 若在当前类中调用请使用如下方式调用否则该方法的事务注解不生效
* ShareInfoService shareInfoService = CommonBeanFactory.getBean(ShareInfoService.class); * ShareInfoService shareInfoService = CommonBeanFactory.getBean(ShareInfoService.class);
* shareInfoService.validateExpired(shareInfo); * shareInfoService.validateExpired(shareInfo);
*
* @param shareInfo * @param shareInfo
*/ */
@Transactional(propagation = Propagation.NOT_SUPPORTED) @Transactional(propagation = Propagation.NOT_SUPPORTED)

View File

@ -7,7 +7,11 @@
v-if="responseResult.responseCode" v-if="responseResult.responseCode"
:content="responseResult.responseCode" :content="responseResult.responseCode"
placement="top"> placement="top">
<div class="node-title" :class="response && response.success ?'ms-req-success':'ms-req-error'">
<div v-if="response.attachInfoMap && response.attachInfoMap.errorReportResult" class="node-title" :class="'ms-req-error-report-result'">
{{ responseResult && responseResult.responseCode ? responseResult.responseCode : '0' }}
</div>
<div v-else class="node-title" :class="response && response.success ?'ms-req-success':'ms-req-error'">
{{ responseResult && responseResult.responseCode ? responseResult.responseCode : '0' }} {{ responseResult && responseResult.responseCode ? responseResult.responseCode : '0' }}
</div> </div>
</el-tooltip> </el-tooltip>

View File

@ -134,7 +134,10 @@
<el-link v-else-if="scope.row.execResult && scope.row.execResult === 'success'" <el-link v-else-if="scope.row.execResult && scope.row.execResult === 'success'"
type="primary" type="primary"
@click="getReportResult(scope.row)" v-text="getResult(scope.row.execResult)"> @click="getReportResult(scope.row)" v-text="getResult(scope.row.execResult)">
</el-link>
<el-link v-else-if="scope.row.execResult && scope.row.execResult === 'errorReportResult'"
style="color: #F6972A"
@click="getReportResult(scope.row)" v-text="getResult(scope.row.execResult)">
</el-link> </el-link>
<div v-else v-text="getResult(scope.row.execResult)"/> <div v-else v-text="getResult(scope.row.execResult)"/>

View File

@ -142,7 +142,7 @@
<el-link type="danger" @click="showReport(row)" v-if="row.lastResult === 'Fail'"> <el-link type="danger" @click="showReport(row)" v-if="row.lastResult === 'Fail'">
{{ $t('api_test.automation.fail') }} {{ $t('api_test.automation.fail') }}
</el-link> </el-link>
<el-link type="danger" @click="showReport(row)" v-if="row.lastResult === 'errorReportResult'"> <el-link style="color: #F6972A" @click="showReport(row)" v-if="row.lastResult === 'errorReportResult'">
{{ $t('error_report_library.option.name') }} {{ $t('error_report_library.option.name') }}
</el-link> </el-link>
</template> </template>