fix(误报库): 修复场景报告中未执行的条件控制器判断为失败的缺陷

https://www.tapd.cn/55049933/bugtrace/bugs/view?bug_id=1155049933001009790
This commit is contained in:
song-tianyang 2022-01-21 16:39:19 +08:00 committed by fit2-zhao
parent ef10224a12
commit c351adada6
2 changed files with 20 additions and 7 deletions

View File

@ -4,12 +4,14 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import io.metersphere.api.dto.ApiScenarioReportDTO; import io.metersphere.api.dto.ApiScenarioReportDTO;
import io.metersphere.api.dto.RequestResultExpandDTO;
import io.metersphere.api.dto.StepTreeDTO; import io.metersphere.api.dto.StepTreeDTO;
import io.metersphere.base.domain.*; import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.ApiScenarioMapper; import io.metersphere.base.mapper.ApiScenarioMapper;
import io.metersphere.base.mapper.ApiScenarioReportResultMapper; import io.metersphere.base.mapper.ApiScenarioReportResultMapper;
import io.metersphere.base.mapper.ApiScenarioReportStructureMapper; import io.metersphere.base.mapper.ApiScenarioReportStructureMapper;
import io.metersphere.commons.constants.MsTestElementConstants; import io.metersphere.commons.constants.MsTestElementConstants;
import io.metersphere.commons.utils.BeanUtils;
import io.metersphere.commons.utils.CommonBeanFactory; import io.metersphere.commons.utils.CommonBeanFactory;
import io.metersphere.constants.RunModeConstants; import io.metersphere.constants.RunModeConstants;
import io.metersphere.dto.RequestResult; import io.metersphere.dto.RequestResult;
@ -222,14 +224,15 @@ public class ApiScenarioReportStructureService {
} }
} }
if (StringUtils.isNotEmpty(dto.getType()) && requests.contains(dto.getType()) && dto.getValue() == null) { if (StringUtils.isNotEmpty(dto.getType()) && requests.contains(dto.getType()) && dto.getValue() == null) {
RequestResult requestResult = new RequestResult(); RequestResultExpandDTO requestResultExpandDTO = new RequestResultExpandDTO();
requestResult.setName(dto.getLabel()); requestResultExpandDTO.setStatus("unexecute");
dto.setValue(requestResult); requestResultExpandDTO.setName(dto.getLabel());
dto.setValue(requestResultExpandDTO);
} }
if (CollectionUtils.isNotEmpty(dto.getChildren())) { if (CollectionUtils.isNotEmpty(dto.getChildren())) {
reportFormatting(dto.getChildren(), maps); reportFormatting(dto.getChildren(), maps);
if (StringUtils.isEmpty(dto.getErrorCode())) { if (StringUtils.isEmpty(dto.getErrorCode())) {
//统计child的errorCode //统计child的errorCode合并到parent中
List<String> childErrorCodeList = new ArrayList<>(); List<String> childErrorCodeList = new ArrayList<>();
for (StepTreeDTO child : dto.getChildren()) { for (StepTreeDTO child : dto.getChildren()) {
if (StringUtils.isNotEmpty(child.getErrorCode()) && !childErrorCodeList.contains(child.getErrorCode())) { if (StringUtils.isNotEmpty(child.getErrorCode()) && !childErrorCodeList.contains(child.getErrorCode())) {

View File

@ -49,13 +49,17 @@
<i class="el-icon-loading" style="font-size: 16px"/> <i class="el-icon-loading" style="font-size: 16px"/>
{{ $t('commons.testing') }} {{ $t('commons.testing') }}
</el-tag> </el-tag>
<el-tag v-else-if="errorCode" class="ms-test-running" size="mini">
{{ $t('error_report_library.option.name') }}
</el-tag>
<el-tag size="mini" v-else-if="request.unexecute">{{ <el-tag size="mini" v-else-if="request.unexecute">{{
$t('api_test.home_page.detail_card.unexecute') $t('api_test.home_page.detail_card.unexecute')
}} }}
</el-tag> </el-tag>
<el-tag size="mini" v-else-if="request.status && request.status==='unexecute'">{{
$t('api_test.home_page.detail_card.unexecute')
}}
</el-tag>
<el-tag v-else-if="errorCode" class="ms-test-error_code" size="mini">
{{ $t('error_report_library.option.name') }}
</el-tag>
<el-tag size="mini" type="success" v-else-if="request.success"> {{ $t('api_report.success') }}</el-tag> <el-tag size="mini" type="success" v-else-if="request.success"> {{ $t('api_report.success') }}</el-tag>
<el-tag size="mini" type="danger" v-else> {{ $t('api_report.fail') }}</el-tag> <el-tag size="mini" type="danger" v-else> {{ $t('api_report.fail') }}</el-tag>
</div> </div>
@ -223,6 +227,12 @@ export default {
color: #6D317C; color: #6D317C;
} }
.ms-test-error_code {
color: #F6972A;
background-color: #FDF5EA;
border-color: #FDF5EA;
}
.ms-api-col { .ms-api-col {
background-color: #EFF0F0; background-color: #EFF0F0;
border-color: #EFF0F0; border-color: #EFF0F0;