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);
|
planEnvMap = JSON.parseObject(environment, Map.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
String projectId = testPlanScenarioCaseService.getProjectIdById(testPlanScenarioId);
|
||||||
|
if(StringUtils.isEmpty(projectId)){
|
||||||
|
projectId = item.getProjectId();
|
||||||
|
}
|
||||||
if (request.isTestPlanScheduleJob()) {
|
if (request.isTestPlanScheduleJob()) {
|
||||||
String savedScenarioId = testPlanScenarioId + ":" + request.getTestPlanReportId();
|
String savedScenarioId = testPlanScenarioId + ":" + request.getTestPlanReportId();
|
||||||
report = createScenarioReport(reportId, savedScenarioId, item.getName(), request.getTriggerMode(),
|
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 {
|
} else {
|
||||||
report = createScenarioReport(reportId, testPlanScenarioId, item.getName(), request.getTriggerMode(),
|
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 {
|
} else {
|
||||||
report = createScenarioReport(reportId, ExecuteType.Marge.name().equals(request.getExecuteType()) ? serialReportId : item.getId(), item.getName(), request.getTriggerMode(),
|
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));
|
scenario.setEnvironmentMap(JSON.parseObject(environment, Map.class));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String projectId = testPlanScenarioCaseService.getProjectIdById(testPlanScenarioId);
|
||||||
|
if(StringUtils.isEmpty(projectId)){
|
||||||
|
projectId = item.getProjectId();
|
||||||
|
}
|
||||||
|
|
||||||
if (request.isTestPlanScheduleJob()) {
|
if (request.isTestPlanScheduleJob()) {
|
||||||
String savedScenarioId = testPlanScenarioId + ":" + request.getTestPlanReportId();
|
String savedScenarioId = testPlanScenarioId + ":" + request.getTestPlanReportId();
|
||||||
report = createScenarioReport(group.getName(), savedScenarioId, item.getName(), request.getTriggerMode(),
|
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 {
|
} else {
|
||||||
report = createScenarioReport(group.getName(), testPlanScenarioId, item.getName(), request.getTriggerMode() == null ? ReportTriggerMode.MANUAL.name() : request.getTriggerMode(),
|
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 {
|
} else {
|
||||||
report = createScenarioReport(group.getName(), item.getId(), item.getName(), request.getTriggerMode() == null ? ReportTriggerMode.MANUAL.name() : request.getTriggerMode(),
|
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<TestPlanFailureScenarioDTO> getFailureListByIds(@Param("ids") Collection<String> ids, @Param("planId") String planId, @Param("status") String status);
|
||||||
|
|
||||||
List<Integer> getUnderwaySteps(@Param("ids") List<String> underwayIds);
|
List<Integer> getUnderwaySteps(@Param("ids") List<String> underwayIds);
|
||||||
|
|
||||||
|
String getProjectIdById(String testPlanScenarioId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -247,4 +247,10 @@
|
||||||
</foreach>
|
</foreach>
|
||||||
</select>
|
</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>
|
</mapper>
|
||||||
|
|
|
@ -685,9 +685,9 @@ public class TestPlanReportService {
|
||||||
status = TestPlanReportStatus.SUCCESS.name();
|
status = TestPlanReportStatus.SUCCESS.name();
|
||||||
try {
|
try {
|
||||||
if (CollectionUtils.isNotEmpty(reportDTO.getFunctionFailureCases())
|
if (CollectionUtils.isNotEmpty(reportDTO.getFunctionFailureCases())
|
||||||
&& CollectionUtils.isNotEmpty(reportDTO.getApiFailureCases())
|
|| CollectionUtils.isNotEmpty(reportDTO.getApiFailureCases())
|
||||||
&& CollectionUtils.isNotEmpty(reportDTO.getScenarioFailureCases())
|
|| CollectionUtils.isNotEmpty(reportDTO.getScenarioFailureCases())
|
||||||
&& CollectionUtils.isNotEmpty(reportDTO.getLoadFailureCases())) {
|
|| CollectionUtils.isNotEmpty(reportDTO.getLoadFailureCases())) {
|
||||||
status = TestPlanReportStatus.FAILED.name();
|
status = TestPlanReportStatus.FAILED.name();
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
@ -751,7 +751,7 @@ public class TestPlanReportService {
|
||||||
//更新TestPlan状态为完成
|
//更新TestPlan状态为完成
|
||||||
TestPlanWithBLOBs testPlan = testPlanMapper.selectByPrimaryKey(report.getTestPlanId());
|
TestPlanWithBLOBs testPlan = testPlanMapper.selectByPrimaryKey(report.getTestPlanId());
|
||||||
if (testPlan != null) {
|
if (testPlan != null) {
|
||||||
testPlan.setStatus(TestPlanStatus.Completed.name());
|
// testPlan.setStatus(TestPlanStatus.Completed.name());
|
||||||
testPlanMapper.updateByPrimaryKeySelective(testPlan);
|
testPlanMapper.updateByPrimaryKeySelective(testPlan);
|
||||||
}
|
}
|
||||||
if (StringUtils.equalsAny(report.getTriggerMode(), ReportTriggerMode.API.name(), ReportTriggerMode.SCHEDULE.name())) {
|
if (StringUtils.equalsAny(report.getTriggerMode(), ReportTriggerMode.API.name(), ReportTriggerMode.SCHEDULE.name())) {
|
||||||
|
@ -813,7 +813,7 @@ public class TestPlanReportService {
|
||||||
}
|
}
|
||||||
|
|
||||||
NoticeModel noticeModel = NoticeModel.builder()
|
NoticeModel noticeModel = NoticeModel.builder()
|
||||||
.operator(SessionUtils.getUserId())
|
.operator("MeterSphere")
|
||||||
.successContext(successContext)
|
.successContext(successContext)
|
||||||
.successMailTemplate(successfulMailTemplate)
|
.successMailTemplate(successfulMailTemplate)
|
||||||
.failedContext(failedContext)
|
.failedContext(failedContext)
|
||||||
|
|
|
@ -468,4 +468,8 @@ public class TestPlanScenarioCaseService {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getProjectIdById(String testPlanScenarioId) {
|
||||||
|
return extTestPlanScenarioCaseMapper.getProjectIdById(testPlanScenarioId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -990,6 +990,7 @@ public class TestPlanService {
|
||||||
|
|
||||||
@Transactional(propagation = Propagation.NOT_SUPPORTED)
|
@Transactional(propagation = Propagation.NOT_SUPPORTED)
|
||||||
public String run(String testPlanID, String projectID, String userId, String triggerMode, String apiRunConfig) {
|
public String run(String testPlanID, String projectID, String userId, String triggerMode, String apiRunConfig) {
|
||||||
|
triggerMode = ReportTriggerMode.SCHEDULE.name();
|
||||||
//创建测试报告,然后返回的ID重新赋值为resourceID,作为后续的参数
|
//创建测试报告,然后返回的ID重新赋值为resourceID,作为后续的参数
|
||||||
TestPlanScheduleReportInfoDTO reportInfoDTO = testPlanReportService.genTestPlanReportBySchedule(projectID, testPlanID, userId, triggerMode);
|
TestPlanScheduleReportInfoDTO reportInfoDTO = testPlanReportService.genTestPlanReportBySchedule(projectID, testPlanID, userId, triggerMode);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue