fix(测试计划): #1005967 #1006056 测试计划,执行场景用例有一个用例总是不在任务中心显示 【github#5497】测试跟踪-测试计划-定时任务仅执行第一次关联的测试场景用例 (#5694)
【测试计划,执行场景用例有一个用例总是不在任务中心显示】https://www.tapd.cn/55049933/bugtrace/bugs/view?bug_id=1155049933001005967;--bug=1006056 --user=宋天阳 【github#5497】测试跟踪-测试计划-定时任务仅执行第一次关联的测试场景用例 https://www.tapd.cn/55049933/s/1040247; Co-authored-by: song-tianyang <tianyang.song@fit2cloud.com>
This commit is contained in:
parent
e807bb5635
commit
6015fce556
|
@ -1026,13 +1026,17 @@ public class ApiAutomationService {
|
|||
planEnvMap = JSON.parseObject(environment, Map.class);
|
||||
}
|
||||
}
|
||||
String projectId = testPlanScenarioCaseService.getProjectIdById(testPlanScenarioId);
|
||||
if(StringUtils.isEmpty(projectId)){
|
||||
projectId = item.getProjectId();
|
||||
}
|
||||
if (request.isTestPlanScheduleJob()) {
|
||||
String savedScenarioId = testPlanScenarioId + ":" + request.getTestPlanReportId();
|
||||
report = createScenarioReport(reportId, savedScenarioId, item.getName(), request.getTriggerMode(),
|
||||
request.getExecuteType(), item.getProjectId(), request.getReportUserID(), request.getConfig(),item.getId());
|
||||
request.getExecuteType(), projectId, request.getReportUserID(), request.getConfig(),item.getId());
|
||||
} else {
|
||||
report = createScenarioReport(reportId, testPlanScenarioId, item.getName(), request.getTriggerMode(),
|
||||
request.getExecuteType(), item.getProjectId(), request.getReportUserID(), request.getConfig(),item.getId());
|
||||
request.getExecuteType(), projectId, request.getReportUserID(), request.getConfig(),item.getId());
|
||||
}
|
||||
} else {
|
||||
report = createScenarioReport(reportId, ExecuteType.Marge.name().equals(request.getExecuteType()) ? serialReportId : item.getId(), item.getName(), request.getTriggerMode(),
|
||||
|
@ -1251,13 +1255,19 @@ public class ApiAutomationService {
|
|||
scenario.setEnvironmentMap(JSON.parseObject(environment, Map.class));
|
||||
}
|
||||
}
|
||||
|
||||
String projectId = testPlanScenarioCaseService.getProjectIdById(testPlanScenarioId);
|
||||
if(StringUtils.isEmpty(projectId)){
|
||||
projectId = item.getProjectId();
|
||||
}
|
||||
|
||||
if (request.isTestPlanScheduleJob()) {
|
||||
String savedScenarioId = testPlanScenarioId + ":" + request.getTestPlanReportId();
|
||||
report = createScenarioReport(group.getName(), savedScenarioId, item.getName(), request.getTriggerMode(),
|
||||
request.getExecuteType(), item.getProjectId(), request.getReportUserID(), request.getConfig(),item.getId());
|
||||
request.getExecuteType(), projectId, request.getReportUserID(), request.getConfig(),item.getId());
|
||||
} else {
|
||||
report = createScenarioReport(group.getName(), testPlanScenarioId, item.getName(), request.getTriggerMode() == null ? ReportTriggerMode.MANUAL.name() : request.getTriggerMode(),
|
||||
request.getExecuteType(), item.getProjectId(), request.getReportUserID(), request.getConfig(),item.getId());
|
||||
request.getExecuteType(), projectId, request.getReportUserID(), request.getConfig(),item.getId());
|
||||
}
|
||||
} else {
|
||||
report = createScenarioReport(group.getName(), item.getId(), item.getName(), request.getTriggerMode() == null ? ReportTriggerMode.MANUAL.name() : request.getTriggerMode(),
|
||||
|
|
|
@ -34,4 +34,6 @@ public interface ExtTestPlanScenarioCaseMapper {
|
|||
List<TestPlanFailureScenarioDTO> getFailureListByIds(@Param("ids") Collection<String> ids, @Param("planId") String planId, @Param("status") String status);
|
||||
|
||||
List<Integer> getUnderwaySteps(@Param("ids") List<String> underwayIds);
|
||||
|
||||
String getProjectIdById(String testPlanScenarioId);
|
||||
}
|
||||
|
|
|
@ -247,4 +247,10 @@
|
|||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="getProjectIdById" resultType="java.lang.String">
|
||||
SELECT project_id FROM test_plan WHERE id in (
|
||||
SELECT test_plan_id FROM test_plan_api_scenario WHERE id = #{0}
|
||||
)
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -685,9 +685,9 @@ public class TestPlanReportService {
|
|||
status = TestPlanReportStatus.SUCCESS.name();
|
||||
try {
|
||||
if (CollectionUtils.isNotEmpty(reportDTO.getFunctionFailureCases())
|
||||
&& CollectionUtils.isNotEmpty(reportDTO.getApiFailureCases())
|
||||
&& CollectionUtils.isNotEmpty(reportDTO.getScenarioFailureCases())
|
||||
&& CollectionUtils.isNotEmpty(reportDTO.getLoadFailureCases())) {
|
||||
|| CollectionUtils.isNotEmpty(reportDTO.getApiFailureCases())
|
||||
|| CollectionUtils.isNotEmpty(reportDTO.getScenarioFailureCases())
|
||||
|| CollectionUtils.isNotEmpty(reportDTO.getLoadFailureCases())) {
|
||||
status = TestPlanReportStatus.FAILED.name();
|
||||
return status;
|
||||
}
|
||||
|
@ -751,7 +751,7 @@ public class TestPlanReportService {
|
|||
//更新TestPlan状态为完成
|
||||
TestPlanWithBLOBs testPlan = testPlanMapper.selectByPrimaryKey(report.getTestPlanId());
|
||||
if (testPlan != null) {
|
||||
testPlan.setStatus(TestPlanStatus.Completed.name());
|
||||
// testPlan.setStatus(TestPlanStatus.Completed.name());
|
||||
testPlanMapper.updateByPrimaryKeySelective(testPlan);
|
||||
}
|
||||
if (StringUtils.equalsAny(report.getTriggerMode(), ReportTriggerMode.API.name(), ReportTriggerMode.SCHEDULE.name())) {
|
||||
|
@ -813,7 +813,7 @@ public class TestPlanReportService {
|
|||
}
|
||||
|
||||
NoticeModel noticeModel = NoticeModel.builder()
|
||||
.operator(SessionUtils.getUserId())
|
||||
.operator("MeterSphere")
|
||||
.successContext(successContext)
|
||||
.successMailTemplate(successfulMailTemplate)
|
||||
.failedContext(failedContext)
|
||||
|
|
|
@ -468,4 +468,8 @@ public class TestPlanScenarioCaseService {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getProjectIdById(String testPlanScenarioId) {
|
||||
return extTestPlanScenarioCaseMapper.getProjectIdById(testPlanScenarioId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -990,6 +990,7 @@ public class TestPlanService {
|
|||
|
||||
@Transactional(propagation = Propagation.NOT_SUPPORTED)
|
||||
public String run(String testPlanID, String projectID, String userId, String triggerMode, String apiRunConfig) {
|
||||
triggerMode = ReportTriggerMode.SCHEDULE.name();
|
||||
//创建测试报告,然后返回的ID重新赋值为resourceID,作为后续的参数
|
||||
TestPlanScheduleReportInfoDTO reportInfoDTO = testPlanReportService.genTestPlanReportBySchedule(projectID, testPlanID, userId, triggerMode);
|
||||
|
||||
|
|
Loading…
Reference in New Issue