fix(测试跟踪): 功能用例关联了接口测试,执行测试计划功能用例状态未更新
--bug=1022164 --user=李玉号 【测试跟踪】github#21460,测试计划-自动更新状态,功能用例关联了接口测试,执行测试计划功能用例状态没有标记上 https://www.tapd.cn/55049933/s/1339997
This commit is contained in:
parent
53698ab996
commit
dfa5a88659
|
@ -8,10 +8,7 @@ import io.metersphere.base.mapper.*;
|
|||
import io.metersphere.base.mapper.ext.ExtApiDefinitionExecResultMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtApiTestCaseMapper;
|
||||
import io.metersphere.base.mapper.plan.TestPlanApiCaseMapper;
|
||||
import io.metersphere.commons.constants.ApiRunMode;
|
||||
import io.metersphere.commons.constants.CommonConstants;
|
||||
import io.metersphere.commons.constants.NoticeConstants;
|
||||
import io.metersphere.commons.constants.TriggerMode;
|
||||
import io.metersphere.commons.constants.*;
|
||||
import io.metersphere.commons.enums.ApiReportStatus;
|
||||
import io.metersphere.commons.enums.ExecutionExecuteTypeEnum;
|
||||
import io.metersphere.commons.utils.*;
|
||||
|
@ -20,6 +17,7 @@ import io.metersphere.dto.RequestResult;
|
|||
import io.metersphere.dto.ResultDTO;
|
||||
import io.metersphere.notice.sender.NoticeModel;
|
||||
import io.metersphere.notice.service.NoticeSendService;
|
||||
import io.metersphere.service.MicroService;
|
||||
import io.metersphere.service.ServiceUtils;
|
||||
import io.metersphere.utils.LoggerUtil;
|
||||
import org.apache.commons.beanutils.BeanMap;
|
||||
|
@ -64,6 +62,8 @@ public class ApiDefinitionExecResultService {
|
|||
private ApiCaseExecutionInfoService apiCaseExecutionInfoService;
|
||||
@Resource
|
||||
private ExtApiTestCaseMapper extApiTestCaseMapper;
|
||||
@Resource
|
||||
private MicroService microService;
|
||||
|
||||
/**
|
||||
* API/CASE 重试结果保留一条
|
||||
|
@ -103,6 +103,15 @@ public class ApiDefinitionExecResultService {
|
|||
if (apiTestCase != null) {
|
||||
apiTestCase.setLastResultId(dto.getReportId());
|
||||
apiTestCaseMapper.updateByPrimaryKeySelective(apiTestCase);
|
||||
try {
|
||||
HttpHeaderUtils.runAsUser(result.getUserId());
|
||||
microService.getForData(MicroServiceName.TEST_TRACK,
|
||||
String.format("/test/plan/case/update/case/status/%s/%s/%s/%s",
|
||||
testPlanApiCase.getApiCaseId(), apiTestCase.getName(), testPlanApiCase.getTestPlanId(), "testcase"));
|
||||
HttpHeaderUtils.clearUser();
|
||||
} catch (Exception e) {
|
||||
LogUtil.error("auto update test plan api case error.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 发送通知
|
||||
|
@ -335,6 +344,17 @@ public class ApiDefinitionExecResultService {
|
|||
if (apiTestCase != null) {
|
||||
apiTestCase.setLastResultId(dto.getReportId());
|
||||
apiTestCaseMapper.updateByPrimaryKeySelective(apiTestCase);
|
||||
|
||||
try {
|
||||
HttpHeaderUtils.runAsUser(reportResult.getUserId());
|
||||
microService.getForData(MicroServiceName.TEST_TRACK,
|
||||
String.format("/test/plan/case/update/case/status/%s/%s/%s/%s",
|
||||
apiTestCase.getId(), apiTestCase.getName(), apiCase.getTestPlanId(), "testcase"));
|
||||
HttpHeaderUtils.clearUser();
|
||||
} catch (Exception e) {
|
||||
LogUtil.error("auto update test plan api case error.", e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -130,6 +130,11 @@ public class TestPlanTestCaseController {
|
|||
testPlanTestCaseService.deleteTestCaseBath(request);
|
||||
}
|
||||
|
||||
@GetMapping("/update/case/status/{testId}/{testName}/{planId}/{testType}")
|
||||
public void updateCaseStatus(@PathVariable String testId, @PathVariable String testName,@PathVariable String planId,@PathVariable String testType) {
|
||||
testPlanTestCaseService.updateTestCaseStates(testId, testName, planId, testType);
|
||||
}
|
||||
|
||||
@PostMapping("/delete/{id}")
|
||||
@MsAuditLog(module = OperLogModule.TRACK_TEST_PLAN, type = OperLogConstants.UN_ASSOCIATE_CASE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = TestPlanTestCaseService.class)
|
||||
public int deleteTestCase(@PathVariable String id) {
|
||||
|
|
Loading…
Reference in New Issue