fix(测试跟踪): 执行测试计划失败停止时,停止状态的用例状态也同步更新为停止状态
--bug=1025092 --user=宋天阳 【测试跟踪】测试计划-执行测试计划-失败停止-测试计划内报告不显示执行结果 https://www.tapd.cn/55049933/s/1358973
This commit is contained in:
parent
ac953f3231
commit
c293daccee
|
@ -64,5 +64,7 @@ public interface ExtTestPlanApiCaseMapper {
|
|||
List<TestPlanApiCase> selectByRefIds(@Param("ids") List<String> ids);
|
||||
|
||||
List<String> selectResourcePoolIdByReportIds(@Param("ids") List<String> resourceIds);
|
||||
|
||||
void updateStatusStop(@Param("ids") List<String> testIds);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,12 +15,10 @@
|
|||
#{request.createUser},
|
||||
#{request.order}
|
||||
FROM DUAL
|
||||
WHERE NOT EXISTS(
|
||||
SELECT id
|
||||
FROM test_plan_api_case
|
||||
WHERE test_plan_id = #{request.testPlanId}
|
||||
and api_case_id = #{request.apiCaseId}
|
||||
)
|
||||
WHERE NOT EXISTS(SELECT id
|
||||
FROM test_plan_api_case
|
||||
WHERE test_plan_id = #{request.testPlanId}
|
||||
and api_case_id = #{request.apiCaseId})
|
||||
</insert>
|
||||
<select id="getApiTestCaseById" resultType="io.metersphere.base.domain.ApiTestCaseWithBLOBs">
|
||||
SELECT t.*
|
||||
|
@ -364,13 +362,11 @@
|
|||
select id, status
|
||||
from test_plan_api_case
|
||||
where test_plan_id = #{planId}
|
||||
and api_case_id IN (
|
||||
SELECT id
|
||||
FROM api_test_case
|
||||
where status is null
|
||||
or status
|
||||
!= 'Trash'
|
||||
)
|
||||
and api_case_id IN (SELECT id
|
||||
FROM api_test_case
|
||||
where status is null
|
||||
or status
|
||||
!= 'Trash')
|
||||
</select>
|
||||
<select id="getFailureList" resultType="io.metersphere.api.dto.automation.TestPlanApiDTO">
|
||||
select
|
||||
|
@ -479,15 +475,18 @@
|
|||
</select>
|
||||
|
||||
<select id="selectProjectId" resultType="java.lang.String">
|
||||
SELECT project_id FROM test_plan WHERE id IN (
|
||||
SELECT test_plan_id FROM test_plan_api_case WHERE id = #{0}
|
||||
)
|
||||
SELECT project_id
|
||||
FROM test_plan
|
||||
WHERE id IN (SELECT test_plan_id
|
||||
FROM test_plan_api_case
|
||||
WHERE id = #{0})
|
||||
</select>
|
||||
<select id="selectTestPlanByRelevancy" resultType="io.metersphere.api.dto.automation.TestPlanDTO"
|
||||
parameterType="io.metersphere.api.dto.QueryReferenceRequest">
|
||||
SELECT p.id , p.name, project.name as projectName , w.name as workspaceName ,p.workspace_id AS workspaceId, p.project_id AS projectId FROM test_plan p
|
||||
SELECT p.id , p.name, project.name as projectName , w.name as workspaceName ,p.workspace_id AS workspaceId,
|
||||
p.project_id AS projectId FROM test_plan p
|
||||
LEFT JOIN project ON p.project_id = project.id
|
||||
LEFT JOIN `workspace` w ON p.workspace_id = w.id
|
||||
LEFT JOIN `workspace` w ON p.workspace_id = w.id
|
||||
<where>
|
||||
<if test="request.workspaceId != null">
|
||||
and p.workspace_id = #{request.workspaceId}
|
||||
|
@ -555,7 +554,7 @@
|
|||
SELECT a.project_id, t.*
|
||||
FROM test_plan_api_case t
|
||||
INNER JOIN api_test_case a ON t.api_case_id = a.id
|
||||
WHERE t.id in
|
||||
WHERE t.id in
|
||||
<foreach collection="planCaseIds" item="id" separator="," open="(" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
|
@ -568,4 +567,10 @@
|
|||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
<update id="updateStatusStop" parameterType="java.util.List">
|
||||
update test_plan_api_case set status="STOPPED" where id in
|
||||
<foreach collection="ids" item="value" separator="," open="(" close=")">
|
||||
#{value}
|
||||
</foreach>
|
||||
</update>
|
||||
</mapper>
|
||||
|
|
|
@ -12,6 +12,7 @@ import io.metersphere.base.mapper.*;
|
|||
import io.metersphere.base.mapper.ext.BaseApiExecutionQueueMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtApiDefinitionExecResultMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtApiScenarioReportMapper;
|
||||
import io.metersphere.base.mapper.plan.ext.ExtTestPlanApiCaseMapper;
|
||||
import io.metersphere.commons.constants.ApiRunMode;
|
||||
import io.metersphere.commons.constants.KafkaTopicConstants;
|
||||
import io.metersphere.commons.constants.TestPlanReportStatus;
|
||||
|
@ -57,6 +58,8 @@ public class ApiExecutionQueueService {
|
|||
@Resource
|
||||
private ExtApiDefinitionExecResultMapper extApiDefinitionExecResultMapper;
|
||||
@Resource
|
||||
private ExtTestPlanApiCaseMapper extTestPlanApiCaseMapper;
|
||||
@Resource
|
||||
private ExtApiScenarioReportMapper extApiScenarioReportMapper;
|
||||
@Resource
|
||||
private JMeterService jMeterService;
|
||||
|
@ -202,10 +205,14 @@ public class ApiExecutionQueueService {
|
|||
// 更新未执行的报告状态
|
||||
List<ApiExecutionQueueDetail> details = executionQueueDetailMapper.selectByExample(example);
|
||||
List<String> reportIds = details.stream().map(ApiExecutionQueueDetail::getReportId).collect(Collectors.toList());
|
||||
List<String> testIds = details.stream().map(ApiExecutionQueueDetail::getTestId).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(reportIds)) {
|
||||
extApiDefinitionExecResultMapper.update(reportIds);
|
||||
extApiScenarioReportMapper.update(reportIds);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(testIds)) {
|
||||
extTestPlanApiCaseMapper.updateStatusStop(testIds);
|
||||
}
|
||||
// 清除队列
|
||||
executionQueueDetailMapper.deleteByExample(example);
|
||||
queueMapper.deleteByPrimaryKey(executionQueue.getId());
|
||||
|
|
|
@ -290,7 +290,7 @@ public class TestResultService {
|
|||
if (StringUtils.equals(dto.getRunMode(), ApiRunMode.API_PLAN.name())) {
|
||||
TestPlanApiCase testPlanApiCase = testPlanApiCaseMapper.selectByPrimaryKey(dto.getTestId());
|
||||
if (testPlanApiCase != null) {
|
||||
testPlanApiCase.setStatus(ApiReportStatus.ERROR.name());
|
||||
testPlanApiCase.setStatus(result.getStatus());
|
||||
testPlanApiCaseMapper.updateByPrimaryKey(testPlanApiCase);
|
||||
}
|
||||
} else if (StringUtils.isNotEmpty(dto.getTestId())) {
|
||||
|
|
Loading…
Reference in New Issue