fix:测试计划关联测试报错
This commit is contained in:
parent
8f12d2786a
commit
0ab466293c
|
@ -126,6 +126,8 @@ public class TestPlanService {
|
|||
private TestPlanApiScenarioMapper testPlanApiScenarioMapper;
|
||||
@Resource
|
||||
private ApiScenarioMapper apiScenarioMapper;
|
||||
@Resource
|
||||
private TestCaseTestMapper testCaseTestMapper;
|
||||
|
||||
public synchronized String addTestPlan(AddTestPlanRequest testPlan) {
|
||||
if (getTestPlanByName(testPlan.getName()).size() > 0) {
|
||||
|
@ -433,12 +435,18 @@ public class TestPlanService {
|
|||
if(request.getChecked()){
|
||||
if (!testCaseIds.isEmpty()) {
|
||||
testCaseIds.forEach(caseId -> {
|
||||
TestCaseWithBLOBs testDtail=testCaseMapper.selectByPrimaryKey(caseId);
|
||||
if(StringUtils.equals(testDtail.getType(),TestCaseStatus.performance.name())){
|
||||
List<TestCaseTest> list=new ArrayList<>();
|
||||
TestCaseTestExample examp=new TestCaseTestExample();
|
||||
examp.createCriteria().andTestCaseIdEqualTo(caseId);
|
||||
if(testCaseTestMapper.countByExample(examp)>0){
|
||||
list=testCaseTestMapper.selectByExample(examp);
|
||||
}
|
||||
list.forEach(l->{
|
||||
if(StringUtils.equals(l.getTestType(),TestCaseStatus.performance.name())){
|
||||
TestPlanLoadCase t = new TestPlanLoadCase();
|
||||
t.setId(UUID.randomUUID().toString());
|
||||
t.setTestPlanId(request.getPlanId());
|
||||
t.setLoadCaseId(testDtail.getTestId());
|
||||
t.setLoadCaseId(l.getTestId());
|
||||
t.setCreateTime(System.currentTimeMillis());
|
||||
t.setUpdateTime(System.currentTimeMillis());
|
||||
TestPlanLoadCaseExample testPlanLoadCaseExample=new TestPlanLoadCaseExample();
|
||||
|
@ -448,13 +456,13 @@ public class TestPlanService {
|
|||
}
|
||||
|
||||
}
|
||||
if(StringUtils.equals(testDtail.getType(),TestCaseStatus.testcase.name())){
|
||||
if(StringUtils.equals(l.getTestType(),TestCaseStatus.testcase.name())){
|
||||
TestPlanApiCase t=new TestPlanApiCase();
|
||||
ApiTestCaseWithBLOBs apitest=apiTestCaseMapper.selectByPrimaryKey(testDtail.getTestId());
|
||||
ApiTestCaseWithBLOBs apitest=apiTestCaseMapper.selectByPrimaryKey(l.getTestId());
|
||||
ApiDefinitionWithBLOBs apidefinition=apiDefinitionMapper.selectByPrimaryKey(apitest.getApiDefinitionId());
|
||||
t.setId(UUID.randomUUID().toString());
|
||||
t.setTestPlanId(request.getPlanId());
|
||||
t.setApiCaseId(testDtail.getTestId());
|
||||
t.setApiCaseId(l.getTestId());
|
||||
t.setEnvironmentId(apidefinition.getEnvironmentId());
|
||||
t.setCreateTime(System.currentTimeMillis());
|
||||
t.setUpdateTime(System.currentTimeMillis());
|
||||
|
@ -465,12 +473,12 @@ public class TestPlanService {
|
|||
}
|
||||
|
||||
}
|
||||
if(StringUtils.equals(testDtail.getType(),TestCaseStatus.automation.name())){
|
||||
if(StringUtils.equals(l.getTestType(),TestCaseStatus.automation.name())){
|
||||
TestPlanApiScenario t=new TestPlanApiScenario();
|
||||
ApiScenarioWithBLOBs testPlanApiScenario=apiScenarioMapper.selectByPrimaryKey(testDtail.getTestId());
|
||||
ApiScenarioWithBLOBs testPlanApiScenario=apiScenarioMapper.selectByPrimaryKey(l.getTestId());
|
||||
t.setId(UUID.randomUUID().toString());
|
||||
t.setTestPlanId(request.getPlanId());
|
||||
t.setApiScenarioId(testDtail.getTestId());
|
||||
t.setApiScenarioId(l.getTestId());
|
||||
t.setLastResult(testPlanApiScenario.getLastResult());
|
||||
t.setPassRate(testPlanApiScenario.getPassRate());
|
||||
t.setReportId(testPlanApiScenario.getReportId());
|
||||
|
@ -484,6 +492,8 @@ public class TestPlanService {
|
|||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue