feat(测试计划): 执行用例时显示关联测试
This commit is contained in:
parent
bb4f30a9a1
commit
fa0a57a6af
|
@ -1,6 +1,7 @@
|
|||
package io.metersphere.base.mapper.ext;
|
||||
|
||||
import io.metersphere.track.dto.TestCaseReportStatusResultDTO;
|
||||
import io.metersphere.track.dto.TestCaseTestDTO;
|
||||
import io.metersphere.track.dto.TestPlanCaseDTO;
|
||||
import io.metersphere.track.request.testplancase.QueryTestPlanCaseRequest;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
@ -47,4 +48,6 @@ public interface ExtTestPlanTestCaseMapper {
|
|||
List<String> getExecResultByPlanId(String planId);
|
||||
|
||||
List<TestPlanCaseDTO> listForMinder(@Param("planId") String planId);
|
||||
|
||||
List<TestCaseTestDTO> listTestCaseTest(@Param("caseId") String caseId);
|
||||
}
|
||||
|
|
|
@ -421,6 +421,9 @@
|
|||
pc.plan_id = #{planId}
|
||||
</where>
|
||||
</select>
|
||||
<select id="listTestCaseTest" resultType="io.metersphere.track.dto.TestCaseTestDTO">
|
||||
select * from test_case_test where test_case_id = #{caseId};
|
||||
</select>
|
||||
|
||||
<update id="updateTestCaseStates" parameterType="java.lang.String">
|
||||
update test_plan_test_case
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package io.metersphere.track.dto;
|
||||
|
||||
import io.metersphere.base.domain.TestCaseTest;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class TestCaseTestDTO extends TestCaseTest {
|
||||
private String testName;
|
||||
}
|
|
@ -3,6 +3,8 @@ package io.metersphere.track.dto;
|
|||
import io.metersphere.base.domain.TestCaseWithBLOBs;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
@ -18,4 +20,6 @@ public class TestPlanCaseDTO extends TestCaseWithBLOBs {
|
|||
private String reportId;
|
||||
private String model;
|
||||
private String projectName;
|
||||
|
||||
private List<TestCaseTestDTO> list;
|
||||
}
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
package io.metersphere.track.service;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.metersphere.base.domain.TestPlan;
|
||||
import io.metersphere.base.domain.TestPlanTestCaseExample;
|
||||
import io.metersphere.base.domain.TestPlanTestCaseWithBLOBs;
|
||||
import io.metersphere.base.domain.User;
|
||||
import io.metersphere.base.mapper.TestPlanTestCaseMapper;
|
||||
import io.metersphere.base.domain.*;
|
||||
import io.metersphere.base.mapper.*;
|
||||
import io.metersphere.base.mapper.ext.ExtTestPlanTestCaseMapper;
|
||||
import io.metersphere.commons.constants.TestPlanTestCaseStatus;
|
||||
import io.metersphere.commons.user.SessionUser;
|
||||
|
@ -14,6 +11,7 @@ import io.metersphere.commons.utils.ServiceUtils;
|
|||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.controller.request.member.QueryMemberRequest;
|
||||
import io.metersphere.service.UserService;
|
||||
import io.metersphere.track.dto.TestCaseTestDTO;
|
||||
import io.metersphere.track.dto.TestPlanCaseDTO;
|
||||
import io.metersphere.track.request.testcase.TestPlanCaseBatchRequest;
|
||||
import io.metersphere.track.request.testplancase.QueryTestPlanCaseRequest;
|
||||
|
@ -42,6 +40,14 @@ public class TestPlanTestCaseService {
|
|||
|
||||
@Resource
|
||||
ExtTestPlanTestCaseMapper extTestPlanTestCaseMapper;
|
||||
@Resource
|
||||
private TestCaseTestMapper testCaseTestMapper;
|
||||
@Resource
|
||||
private LoadTestMapper loadTestMapper;
|
||||
@Resource
|
||||
private ApiTestCaseMapper apiTestCaseMapper;
|
||||
@Resource
|
||||
private ApiScenarioMapper apiScenarioMapper;
|
||||
|
||||
public List<TestPlanCaseDTO> list(QueryTestPlanCaseRequest request) {
|
||||
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||
|
@ -134,7 +140,40 @@ public class TestPlanTestCaseService {
|
|||
}
|
||||
|
||||
public TestPlanCaseDTO get(String testplanTestCaseId) {
|
||||
return extTestPlanTestCaseMapper.get(testplanTestCaseId);
|
||||
TestPlanCaseDTO testPlanCaseDTO = extTestPlanTestCaseMapper.get(testplanTestCaseId);
|
||||
List<TestCaseTestDTO> testCaseTestDTOS = extTestPlanTestCaseMapper.listTestCaseTest(testPlanCaseDTO.getCaseId());
|
||||
testCaseTestDTOS.forEach(dto -> {
|
||||
setTestName(dto);
|
||||
});
|
||||
testPlanCaseDTO.setList(testCaseTestDTOS);
|
||||
return testPlanCaseDTO;
|
||||
}
|
||||
|
||||
private void setTestName(TestCaseTestDTO dto) {
|
||||
String type = dto.getTestType();
|
||||
String id = dto.getTestId();
|
||||
switch (type) {
|
||||
case "performance":
|
||||
LoadTest loadTest = loadTestMapper.selectByPrimaryKey(id);
|
||||
if (loadTest != null) {
|
||||
dto.setTestName(loadTest.getName());
|
||||
}
|
||||
break;
|
||||
case "testcase":
|
||||
ApiTestCaseWithBLOBs apiTestCaseWithBLOBs = apiTestCaseMapper.selectByPrimaryKey(id);
|
||||
if (apiTestCaseWithBLOBs != null) {
|
||||
dto.setTestName(apiTestCaseWithBLOBs.getName());
|
||||
}
|
||||
break;
|
||||
case "automation":
|
||||
ApiScenarioWithBLOBs apiScenarioWithBLOBs = apiScenarioMapper.selectByPrimaryKey(id);
|
||||
if (apiScenarioWithBLOBs != null) {
|
||||
dto.setTestName(apiScenarioWithBLOBs.getName());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteTestCaseBath(TestPlanCaseBatchRequest request) {
|
||||
|
|
|
@ -44,12 +44,12 @@ export default {
|
|||
component: () => import('@/business/components/api/report/ApiReportView'),
|
||||
},
|
||||
{
|
||||
path: "definition",
|
||||
path: "definition/:redirectID?/:dataType?/:dataSelectRange?",
|
||||
name: "ApiDefinition",
|
||||
component: () => import('@/business/components/api/definition/ApiDefinition'),
|
||||
},
|
||||
{
|
||||
path: "automation",
|
||||
path: "automation/:redirectID?/:dataType?/:dataSelectRange?",
|
||||
name: "ApiAutomation",
|
||||
component: () => import('@/business/components/api/automation/ApiAutomation'),
|
||||
},
|
||||
|
|
|
@ -85,6 +85,15 @@
|
|||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :offset="1">
|
||||
<span class="cast_label">关联测试:</span>
|
||||
<span v-for="(item,index) in testCase.list" :key="index">
|
||||
<el-button @click="openTest(item)" type="text" style="margin-left: 7px;">{{ item.testName }}</el-button>
|
||||
</span>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :offset="1">
|
||||
<span class="cast_label">{{ $t('test_track.case.prerequisite') }}:</span>
|
||||
|
@ -351,7 +360,7 @@ import ApiTestDetail from "../test/ApiTestDetail";
|
|||
import ApiTestResult from "../test/ApiTestResult";
|
||||
import PerformanceTestDetail from "../test/PerformanceTestDetail";
|
||||
import PerformanceTestResult from "../test/PerformanceTestResult";
|
||||
import {listenGoBack, removeGoBackListener} from "@/common/js/utils";
|
||||
import {getUUID, listenGoBack, removeGoBackListener} from "@/common/js/utils";
|
||||
import TestCaseAttachment from "@/business/components/track/case/components/TestCaseAttachment";
|
||||
import CaseComment from "@/business/components/track/case/components/CaseComment";
|
||||
import MsPreviousNextButton from "../../../../../common/components/MsPreviousNextButton";
|
||||
|
@ -559,6 +568,29 @@ export default {
|
|||
}
|
||||
});
|
||||
},
|
||||
openTest(item) {
|
||||
const type = item.testType;
|
||||
const id = item.testId;
|
||||
switch (type) {
|
||||
case "performance": {
|
||||
let performanceData = this.$router.resolve({
|
||||
path: '/performance/test/edit/' + id,
|
||||
})
|
||||
window.open(performanceData.href, '_blank');
|
||||
break;
|
||||
}
|
||||
case "testcase": {
|
||||
let caseData = this.$router.resolve({name:'ApiDefinition',params:{redirectID:getUUID(),dataType:"apiTestCase",dataSelectRange:'single:'+id}});
|
||||
window.open(caseData.href, '_blank');
|
||||
break;
|
||||
}
|
||||
case "automation": {
|
||||
let automationData = this.$router.resolve({name:'ApiAutomation',params:{redirectID:getUUID(),dataType:"scenario",dataSelectRange:'edit:'+id}});
|
||||
window.open(automationData.href, '_blank');
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
getRelatedTest() {
|
||||
if (this.testCase.method === 'auto' && this.testCase.testId && this.testCase.testId !== 'other') {
|
||||
this.$get('/' + this.testCase.type + '/get/' + this.testCase.testId, response => {
|
||||
|
|
Loading…
Reference in New Issue