fix(接口场景): 修复接口场景最后一次执行失败的情况下测试计划中的最后执行结果不显示的问题

--bug=1009926 --user=宋天阳 【测试跟踪】测试计划,场景用例列表,失败的场景不显示最后结果
https://www.tapd.cn/55049933/s/1097432
This commit is contained in:
song-tianyang 2022-01-24 14:20:06 +08:00 committed by song-tianyang
parent 29c0cc00a8
commit b2bb3a486f
5 changed files with 16 additions and 2 deletions

View File

@ -1101,6 +1101,9 @@ public class ApiDefinitionService {
ApiDefinitionImport apiImport = null;
try {
apiImport = (ApiDefinitionImport) Objects.requireNonNull(runService).parse(file == null ? null : file.getInputStream(), request);
if(apiImport.getMocks() == null){
apiImport.setMocks(new ArrayList<>());
}
} catch (Exception e) {
LogUtil.error(e.getMessage(), e);
String returnThrowException = e.getMessage();

View File

@ -351,7 +351,12 @@ public class ApiScenarioReportService {
scenario = apiScenarioMapper.selectByPrimaryKey(report.getScenarioId());
}
if (scenario != null) {
if(StringUtils.equalsAnyIgnoreCase(status,ExecuteResult.errorReportResult.name())){
scenario.setLastResult(status);
}else {
scenario.setLastResult(errorSize > 0 ? "Fail" : ScenarioStatus.Success.name());
}
long successSize = requestResults.stream().filter(requestResult -> StringUtils.equalsIgnoreCase(requestResult.getStatus(), ScenarioStatus.Success.name())).count();
scenario.setPassRate(new DecimalFormat("0%").format((float) successSize / requestResults.size()));
scenario.setReportId(dto.getReportId());

View File

@ -15,7 +15,7 @@
<el-tag size="mini" type="danger" v-else-if="row.status === 'Error'">
{{ row.status }}
</el-tag>
<el-tag size="mini" type="danger" v-else-if="row.status === 'errorReportResult'">
<el-tag size="mini" type="danger" style="background-color: #F6972A; color: #FFFFFF" v-else-if="row.status === 'errorReportResult'">
{{ $t('error_report_library.option.name') }}
</el-tag>
<el-tag v-else size="mini" type="info">

View File

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

View File

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