fix(接口测试): 解决导入接口运行生成报告问题

--user=郭雨琦
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001016692
This commit is contained in:
guoyuqi 2022-09-13 15:53:25 +08:00 committed by xiaomeinvG
parent 05ba122380
commit 18adfa83af
4 changed files with 16 additions and 5 deletions

View File

@ -286,7 +286,7 @@ public class ApiCaseExecuteService {
request.setConfig(new RunModeConfigDTO());
}
if (StringUtils.equals("GROUP", request.getConfig().getEnvironmentType()) && StringUtils.isNotEmpty(request.getConfig().getEnvironmentGroupId())) {
if (StringUtils.equals(EnvironmentType.GROUP.toString(), request.getConfig().getEnvironmentType()) && StringUtils.isNotEmpty(request.getConfig().getEnvironmentGroupId())) {
request.getConfig().setEnvMap(environmentGroupProjectService.getEnvMap(request.getConfig().getEnvironmentGroupId()));
}
@ -294,10 +294,7 @@ public class ApiCaseExecuteService {
(query) -> extApiTestCaseMapper.selectIdsByQuery((ApiTestCaseRequest) query));
List<MsExecResponseDTO> responseDTOS = new LinkedList<>();
ApiTestCaseExample example = new ApiTestCaseExample();
example.createCriteria().andIdIn(request.getIds()).andStatusNotEqualTo("Trash");
List<ApiTestCaseWithBLOBs> caseList = apiTestCaseMapper.selectByExampleWithBLOBs(example);
List<ApiTestCaseWithBLOBs> caseList = extApiTestCaseMapper.unTrashCaseListByIds(request.getIds());
LoggerUtil.debug("查询到执行数据:" + caseList.size());
Map<String, List<String>> testCaseEnvMap = new HashMap<>();
// 环境检查

View File

@ -1001,6 +1001,8 @@ public class ApiDefinitionService {
apiTestCaseWithBLOBs.setPriority("P0");
}
apiTestCaseWithBLOBs.setStatus("");
if (StringUtils.isNotBlank(apiTestCaseWithBLOBs.getId())) {
BeanUtils.copyBean(apiTestCaseDTO, apiTestCaseWithBLOBs);
apiTestCaseDTO.setUpdated(true);

View File

@ -16,6 +16,8 @@ public interface ExtApiTestCaseMapper {
List<ApiTestCaseWithBLOBs> caseList(@Param("request") ApiTestCaseRequest request);
List<ApiTestCaseWithBLOBs> unTrashCaseListByIds(@Param("ids") List<String> ids);
List<ApiTestCaseDTO> listSimple(@Param("request") ApiTestCaseRequest request);
List<String> selectIdsNotExistsInPlan(@Param("projectId") String projectId, @Param("planId") String planId);

View File

@ -1008,4 +1008,14 @@
</foreach>
</if>
</select>
<select id="unTrashCaseListByIds" resultType="io.metersphere.base.domain.ApiTestCaseWithBLOBs">
SELECT * FROM api_test_case
<where>
(api_test_case.status IS NULL OR api_test_case.status != 'Trash')
AND id IN
<foreach collection="ids" item="v" separator="," open="(" close=")">
#{v}
</foreach>
</where>
</select>
</mapper>