fix(接口测试): 修复stop状态的用例报告名称看不到的问题
--bug=1013828 --user=宋天阳 【接口测试】case独立报告-未执行状态,没有显示报告名称 https://www.tapd.cn/55049933/s/1174344
This commit is contained in:
parent
3711ab2066
commit
82516434f7
|
@ -137,6 +137,8 @@ public class ApiDefinitionService {
|
|||
private ProjectApplicationService projectApplicationService;
|
||||
@Resource
|
||||
private EsbApiParamsMapper esbApiParamsMapper;
|
||||
@Resource
|
||||
private ExtTestPlanApiCaseMapper extTestPlanApiCaseMapper;
|
||||
|
||||
private ThreadLocal<Long> currentApiOrder = new ThreadLocal<>();
|
||||
private ThreadLocal<Long> currentApiCaseOrder = new ThreadLocal<>();
|
||||
|
@ -1110,7 +1112,9 @@ public class ApiDefinitionService {
|
|||
CollectionUtils.isNotEmpty(request.getTestElement().getHashTree()) &&
|
||||
CollectionUtils.isNotEmpty(request.getTestElement().getHashTree().get(0).getHashTree()) ?
|
||||
request.getTestElement().getHashTree().get(0).getHashTree().get(0).getName() : request.getId();
|
||||
String reportName = this.getReportNameByTestId(testId);
|
||||
ApiDefinitionExecResultWithBLOBs result = ApiDefinitionExecResultUtil.add(testId, APITestStatus.Running.name(), request.getId(), Objects.requireNonNull(SessionUtils.getUser()).getId());
|
||||
result.setName(reportName);
|
||||
result.setProjectId(request.getProjectId());
|
||||
result.setTriggerMode(TriggerMode.MANUAL.name());
|
||||
apiDefinitionExecResultMapper.insert(result);
|
||||
|
@ -1125,6 +1129,20 @@ public class ApiDefinitionService {
|
|||
return apiExecuteService.debug(request, bodyFiles);
|
||||
}
|
||||
|
||||
private String getReportNameByTestId(String testId) {
|
||||
String testName = extApiDefinitionMapper.selectNameById(testId);
|
||||
if(StringUtils.isEmpty(testName)){
|
||||
testName = extApiTestCaseMapper.selectNameById(testId);
|
||||
if(StringUtils.isEmpty(testName)){
|
||||
String resourceID = extTestPlanApiCaseMapper.getApiTestCaseIdById(testId);
|
||||
if(StringUtils.isNotEmpty(resourceID)){
|
||||
testName = extApiTestCaseMapper.selectNameById(resourceID);
|
||||
}
|
||||
}
|
||||
}
|
||||
return testName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取存储执行结果报告
|
||||
*
|
||||
|
|
|
@ -88,4 +88,5 @@ public interface ExtApiDefinitionMapper {
|
|||
|
||||
List<String> selectRefIdsForVersionChange(@Param("versionId") String versionId, @Param("projectId") String projectId);
|
||||
|
||||
String selectNameById(String testId);
|
||||
}
|
||||
|
|
|
@ -938,4 +938,8 @@
|
|||
WHERE version_id = #{versionId} AND project_id = #{projectId}
|
||||
) AND project_id = #{projectId}
|
||||
</select>
|
||||
|
||||
<select id="selectNameById" resultType="java.lang.String">
|
||||
SELECT name FROM api_definition WHERE id = #{0}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -28,6 +28,7 @@ public interface ExtTestPlanApiCaseMapper {
|
|||
|
||||
ApiTestCaseWithBLOBs getApiTestCaseById(String testPlanApiCaseId);
|
||||
|
||||
String getApiTestCaseIdById(String testPlanApiCaseId);
|
||||
|
||||
List<TestPlanApiCase> selectLegalDataByTestPlanId(String planId);
|
||||
|
||||
|
|
|
@ -18,7 +18,9 @@
|
|||
INNER JOIN test_plan_api_case tpac ON t.id = tpac.api_case_id
|
||||
WHERE tpac.id = #{0}
|
||||
</select>
|
||||
|
||||
<select id="getApiTestCaseIdById" resultType="java.lang.String">
|
||||
SELECT api_case_id FROM test_plan_api_case t WHERE id = #{0}
|
||||
</select>
|
||||
<select id="selectLegalDataByTestPlanId" resultType="io.metersphere.base.domain.TestPlanApiCase">
|
||||
SELECT t.* FROM test_plan_api_case t WHERE t.test_plan_id = #{0}
|
||||
AND t.api_case_id IN (
|
||||
|
|
Loading…
Reference in New Issue