fix(接口场景): 修复接口场景最后一次执行失败的情况下测试计划中的最后执行结果不显示的问题
--bug=1009926 --user=宋天阳 【测试跟踪】测试计划,场景用例列表,失败的场景不显示最后结果 https://www.tapd.cn/55049933/s/1097432
This commit is contained in:
parent
c32ec09575
commit
188ac78f10
|
@ -1101,6 +1101,9 @@ public class ApiDefinitionService {
|
||||||
ApiDefinitionImport apiImport = null;
|
ApiDefinitionImport apiImport = null;
|
||||||
try {
|
try {
|
||||||
apiImport = (ApiDefinitionImport) Objects.requireNonNull(runService).parse(file == null ? null : file.getInputStream(), request);
|
apiImport = (ApiDefinitionImport) Objects.requireNonNull(runService).parse(file == null ? null : file.getInputStream(), request);
|
||||||
|
if(apiImport.getMocks() == null){
|
||||||
|
apiImport.setMocks(new ArrayList<>());
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtil.error(e.getMessage(), e);
|
LogUtil.error(e.getMessage(), e);
|
||||||
String returnThrowException = e.getMessage();
|
String returnThrowException = e.getMessage();
|
||||||
|
|
|
@ -351,7 +351,12 @@ public class ApiScenarioReportService {
|
||||||
scenario = apiScenarioMapper.selectByPrimaryKey(report.getScenarioId());
|
scenario = apiScenarioMapper.selectByPrimaryKey(report.getScenarioId());
|
||||||
}
|
}
|
||||||
if (scenario != null) {
|
if (scenario != null) {
|
||||||
|
if(StringUtils.equalsAnyIgnoreCase(status,ExecuteResult.errorReportResult.name())){
|
||||||
|
scenario.setLastResult(status);
|
||||||
|
}else {
|
||||||
scenario.setLastResult(errorSize > 0 ? "Fail" : ScenarioStatus.Success.name());
|
scenario.setLastResult(errorSize > 0 ? "Fail" : ScenarioStatus.Success.name());
|
||||||
|
}
|
||||||
|
|
||||||
long successSize = requestResults.stream().filter(requestResult -> StringUtils.equalsIgnoreCase(requestResult.getStatus(), ScenarioStatus.Success.name())).count();
|
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.setPassRate(new DecimalFormat("0%").format((float) successSize / requestResults.size()));
|
||||||
scenario.setReportId(dto.getReportId());
|
scenario.setReportId(dto.getReportId());
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<el-tag size="mini" type="danger" v-else-if="row.status === 'Error'">
|
<el-tag size="mini" type="danger" v-else-if="row.status === 'Error'">
|
||||||
{{ row.status }}
|
{{ row.status }}
|
||||||
</el-tag>
|
</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') }}
|
{{ $t('error_report_library.option.name') }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
<el-tag v-else size="mini" type="info">
|
<el-tag v-else size="mini" type="info">
|
||||||
|
|
|
@ -218,6 +218,9 @@
|
||||||
<el-link type="danger" @click="showReport(row)" v-else-if="row.lastResult === 'Fail'">
|
<el-link type="danger" @click="showReport(row)" v-else-if="row.lastResult === 'Fail'">
|
||||||
{{ $t('api_test.automation.fail') }}
|
{{ $t('api_test.automation.fail') }}
|
||||||
</el-link>
|
</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>
|
</template>
|
||||||
</ms-table-column>
|
</ms-table-column>
|
||||||
|
|
||||||
|
|
|
@ -156,6 +156,9 @@
|
||||||
<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 === 'Error'">
|
||||||
|
{{ $t('api_test.automation.fail') }}
|
||||||
|
</el-link>
|
||||||
<el-link style="color: #F6972A" @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>
|
||||||
|
|
Loading…
Reference in New Issue