refactor(测试跟踪): 用例评审查询优化
This commit is contained in:
parent
44e21cea8f
commit
439cf3b89b
|
@ -40,11 +40,4 @@ public interface ExtTestPlanTestCaseMapper {
|
||||||
|
|
||||||
TestPlanCaseDTO get(String testPlanTestCaseId);
|
TestPlanCaseDTO get(String testPlanTestCaseId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取测试计划下的 TestPlanTestCaseID 和 TestCaseName
|
|
||||||
* @param request planId 不能为空
|
|
||||||
* @return List<TestPlanCaseDTO>
|
|
||||||
*/
|
|
||||||
List<TestPlanCaseDTO> getTestPlanTestCaseList(@Param("request") QueryTestPlanCaseRequest request);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -214,13 +214,6 @@
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getTestPlanTestCaseList" resultType="io.metersphere.track.dto.TestPlanCaseDTO">
|
|
||||||
select test_plan_test_case.id as id, test_case.name
|
|
||||||
from test_plan_test_case
|
|
||||||
inner join test_case on test_plan_test_case.case_id = test_case.id
|
|
||||||
where test_plan_test_case.plan_id = #{request.planId}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="listTestCaseByProjectIds" resultType="io.metersphere.track.dto.TestPlanCaseDTO">
|
<select id="listTestCaseByProjectIds" resultType="io.metersphere.track.dto.TestPlanCaseDTO">
|
||||||
select distinct * from test_plan_test_case, test_case
|
select distinct * from test_plan_test_case, test_case
|
||||||
where test_plan_test_case.case_id = test_case.id
|
where test_plan_test_case.case_id = test_case.id
|
||||||
|
|
|
@ -19,4 +19,11 @@ public interface ExtTestReviewCaseMapper {
|
||||||
* @return List<TestReviewCaseDTO>
|
* @return List<TestReviewCaseDTO>
|
||||||
*/
|
*/
|
||||||
List<TestReviewCaseDTO> listTestCaseByProjectIds(@Param("ids") List<String> ids);
|
List<TestReviewCaseDTO> listTestCaseByProjectIds(@Param("ids") List<String> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取 TestReviewTestCase 详细信息
|
||||||
|
* @param id TestReviewTestCase id
|
||||||
|
* @return TestReviewTestCase 详细信息
|
||||||
|
*/
|
||||||
|
TestReviewCaseDTO get(@Param("id") String id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,10 @@
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="list" resultType="io.metersphere.track.dto.TestReviewCaseDTO">
|
<select id="list" resultType="io.metersphere.track.dto.TestReviewCaseDTO">
|
||||||
select test_case.remark, test_case_review_test_case.*, test_case.*, test_case_node.name as model, project.name as projectName
|
select test_case_review_test_case.id as id, test_case.id as caseId, test_case.name, test_case.priority,
|
||||||
|
test_case.type, test_case.node_path, test_case.method, test_case.num, test_case_review_test_case.reviewer,
|
||||||
|
test_case.review_status, test_case_review_test_case.update_time, test_case_node.name as model,
|
||||||
|
project.name as projectName, test_case_review_test_case.review_id as reviewId
|
||||||
from test_case_review_test_case
|
from test_case_review_test_case
|
||||||
inner join test_case on test_case_review_test_case.case_id = test_case.id
|
inner join test_case on test_case_review_test_case.case_id = test_case.id
|
||||||
left join test_case_node on test_case_node.id=test_case.node_id
|
left join test_case_node on test_case_node.id=test_case.node_id
|
||||||
|
@ -181,6 +184,15 @@
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="get" resultType="io.metersphere.track.dto.TestReviewCaseDTO">
|
||||||
|
select test_case.remark, test_case_review_test_case.*, test_case.*, test_case_node.name as model, project.name as projectName
|
||||||
|
from test_case_review_test_case
|
||||||
|
inner join test_case on test_case_review_test_case.case_id = test_case.id
|
||||||
|
left join test_case_node on test_case_node.id=test_case.node_id
|
||||||
|
inner join project on project.id = test_case.project_id
|
||||||
|
where test_case_review_test_case.id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="getStatusByReviewId" resultType="java.lang.String">
|
<select id="getStatusByReviewId" resultType="java.lang.String">
|
||||||
select review_status
|
select review_status
|
||||||
from test_case
|
from test_case
|
||||||
|
|
|
@ -61,6 +61,10 @@ public class CheckOwnerService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkPerformanceTestOwner(String testId) {
|
public void checkPerformanceTestOwner(String testId) {
|
||||||
|
// 关联为其他时
|
||||||
|
if (StringUtils.equals("other", testId)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
String workspaceId = SessionUtils.getCurrentWorkspaceId();
|
String workspaceId = SessionUtils.getCurrentWorkspaceId();
|
||||||
QueryTestPlanRequest request = new QueryTestPlanRequest();
|
QueryTestPlanRequest request = new QueryTestPlanRequest();
|
||||||
request.setWorkspaceId(workspaceId);
|
request.setWorkspaceId(workspaceId);
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class FileService {
|
||||||
final List<LoadTestFile> loadTestFiles = loadTestFileMapper.selectByExample(loadTestFileExample);
|
final List<LoadTestFile> loadTestFiles = loadTestFileMapper.selectByExample(loadTestFileExample);
|
||||||
|
|
||||||
if (CollectionUtils.isEmpty(loadTestFiles)) {
|
if (CollectionUtils.isEmpty(loadTestFiles)) {
|
||||||
return null;
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
List<String> fileIds = loadTestFiles.stream().map(LoadTestFile::getFileId).collect(Collectors.toList());
|
List<String> fileIds = loadTestFiles.stream().map(LoadTestFile::getFileId).collect(Collectors.toList());
|
||||||
FileMetadataExample example = new FileMetadataExample();
|
FileMetadataExample example = new FileMetadataExample();
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class TestReviewTestCaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/list/all")
|
@PostMapping("/list/all")
|
||||||
public List<TestReviewCaseDTO> getTestPlanCases(@RequestBody QueryCaseReviewRequest request) {
|
public List<TestReviewCaseDTO> getTestReviewCases(@RequestBody QueryCaseReviewRequest request) {
|
||||||
return testReviewTestCaseService.list(request);
|
return testReviewTestCaseService.list(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,4 +53,17 @@ public class TestReviewTestCaseController {
|
||||||
public void editTestCase(@RequestBody TestCaseReviewTestCase testCaseReviewTestCase) {
|
public void editTestCase(@RequestBody TestCaseReviewTestCase testCaseReviewTestCase) {
|
||||||
testReviewTestCaseService.editTestCase(testCaseReviewTestCase);
|
testReviewTestCaseService.editTestCase(testCaseReviewTestCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get/{reviewId}")
|
||||||
|
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
|
||||||
|
public TestReviewCaseDTO get(@PathVariable String reviewId) {
|
||||||
|
return testReviewTestCaseService.get(reviewId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/list/ids")
|
||||||
|
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
|
||||||
|
public List<TestReviewCaseDTO> getTestReviewCaseList(@RequestBody QueryCaseReviewRequest request) {
|
||||||
|
return testReviewTestCaseService.getTestCaseReviewDTOList(request);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,4 +128,13 @@ public class TestReviewTestCaseService {
|
||||||
testCase.setReviewStatus(testCaseReviewTestCase.getStatus());
|
testCase.setReviewStatus(testCaseReviewTestCase.getStatus());
|
||||||
testCaseMapper.updateByPrimaryKeySelective(testCase);
|
testCaseMapper.updateByPrimaryKeySelective(testCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<TestReviewCaseDTO> getTestCaseReviewDTOList(QueryCaseReviewRequest request) {
|
||||||
|
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||||
|
return extTestReviewCaseMapper.list(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TestReviewCaseDTO get(String reviewId) {
|
||||||
|
return extTestReviewCaseMapper.get(reviewId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -472,6 +472,7 @@ export default {
|
||||||
this.getTestCase(this.index);
|
this.getTestCase(this.index);
|
||||||
},
|
},
|
||||||
getTestCase(index) {
|
getTestCase(index) {
|
||||||
|
this.testCase = {};
|
||||||
let testCase = this.testCases[index];
|
let testCase = this.testCases[index];
|
||||||
// id 为 TestPlanTestCase 的 id
|
// id 为 TestPlanTestCase 的 id
|
||||||
this.result = this.$get('/test/plan/case/get/' + testCase.id, response => {
|
this.result = this.$get('/test/plan/case/get/' + testCase.id, response => {
|
||||||
|
@ -495,11 +496,10 @@ export default {
|
||||||
this.testCase = item;
|
this.testCase = item;
|
||||||
this.getRelatedTest();
|
this.getRelatedTest();
|
||||||
this.initTest();
|
this.initTest();
|
||||||
|
this.getIssues(item.caseId);
|
||||||
|
this.stepResultChange();
|
||||||
|
this.getFileMetaData(item);
|
||||||
})
|
})
|
||||||
|
|
||||||
this.getIssues(testCase.caseId);
|
|
||||||
this.stepResultChange();
|
|
||||||
this.getFileMetaData(testCase);
|
|
||||||
},
|
},
|
||||||
getFileMetaData(testCase) {
|
getFileMetaData(testCase) {
|
||||||
this.tableData = [];
|
this.tableData = [];
|
||||||
|
|
|
@ -102,10 +102,11 @@
|
||||||
<el-col class="test-detail" :span="20" :offset="1">
|
<el-col class="test-detail" :span="20" :offset="1">
|
||||||
<el-tabs v-model="activeTab" type="border-card">
|
<el-tabs v-model="activeTab" type="border-card">
|
||||||
<el-tab-pane name="detail" :label="$t('test_track.plan_view.test_detail')">
|
<el-tab-pane name="detail" :label="$t('test_track.plan_view.test_detail')">
|
||||||
<api-test-detail :is-read-only="true" v-if="testCase.type === 'api'" @runTest="testRun"
|
<api-test-detail :is-read-only="true" v-if="testCase.type === 'api'"
|
||||||
:id="testCase.testId" ref="apiTestDetail"/>
|
:id="testCase.testId" ref="apiTestDetail"/>
|
||||||
<performance-test-detail :is-read-only="true" v-if="testCase.type === 'performance'"
|
<performance-test-detail v-if="testCase.type === 'performance'"
|
||||||
@runTest="testRun" :id="testCase.testId"
|
:is-read-only="true"
|
||||||
|
:id="testCase.testId"
|
||||||
ref="performanceTestDetail"/>
|
ref="performanceTestDetail"/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
|
@ -211,7 +212,6 @@
|
||||||
<test-case-attachment :table-data="tableData"
|
<test-case-attachment :table-data="tableData"
|
||||||
:read-only="false"
|
:read-only="false"
|
||||||
:is-delete="false"
|
:is-delete="false"
|
||||||
@handleDelete="handleDelete"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
@ -338,20 +338,26 @@ export default {
|
||||||
this.getTestCase(this.index);
|
this.getTestCase(this.index);
|
||||||
},
|
},
|
||||||
getTestCase(index) {
|
getTestCase(index) {
|
||||||
|
this.testCase = {};
|
||||||
let testCase = this.testCases[index];
|
let testCase = this.testCases[index];
|
||||||
let item = {};
|
this.result = this.$get("/test/review/case/get/" + testCase.id, response => {
|
||||||
Object.assign(item, testCase);
|
let item = {};
|
||||||
item.steps = JSON.parse(item.steps);
|
let data = response.data;
|
||||||
item.steptResults = [];
|
Object.assign(item, data);
|
||||||
for (let i = 0; i < item.steps.length; i++) {
|
item.steps = JSON.parse(item.steps);
|
||||||
item.steps[i].actualResult = '';
|
item.steptResults = [];
|
||||||
item.steps[i].executeResult = '';
|
for (let i = 0; i < item.steps.length; i++) {
|
||||||
item.steptResults.push(item.steps[i]);
|
item.steps[i].actualResult = '';
|
||||||
}
|
item.steps[i].executeResult = '';
|
||||||
this.testCase = item;
|
item.steptResults.push(item.steps[i]);
|
||||||
this.getComments(item);
|
}
|
||||||
this.initTest();
|
this.testCase = item;
|
||||||
this.getFileMetaData(testCase);
|
this.getRelatedTest();
|
||||||
|
this.getComments(item);
|
||||||
|
this.initTest();
|
||||||
|
this.getFileMetaData(data);
|
||||||
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
getFileMetaData(testCase) {
|
getFileMetaData(testCase) {
|
||||||
this.tableData = [];
|
this.tableData = [];
|
||||||
|
@ -375,21 +381,16 @@ export default {
|
||||||
},
|
},
|
||||||
initTest() {
|
initTest() {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
if (this.testCase.method === 'auto') {
|
if (this.testCase.testId && this.testCase.testId !== 'other') {
|
||||||
if (this.$refs.apiTestDetail && this.testCase.type === 'api') {
|
if (this.testCase.method === 'auto') {
|
||||||
this.$refs.apiTestDetail.init();
|
if (this.$refs.apiTestDetail && this.testCase.type === 'api') {
|
||||||
} else if (this.testCase.type === 'performance') {
|
this.$refs.apiTestDetail.init();
|
||||||
this.$refs.performanceTestDetail.init();
|
} else if (this.testCase.type === 'performance') {
|
||||||
|
this.$refs.performanceTestDetail.init();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
|
||||||
testRun(reportId) {
|
|
||||||
this.testCase.reportId = reportId;
|
|
||||||
this.saveReport(reportId);
|
|
||||||
},
|
|
||||||
saveReport(reportId) {
|
|
||||||
|
|
||||||
},
|
},
|
||||||
getComments(testCase) {
|
getComments(testCase) {
|
||||||
let id = '';
|
let id = '';
|
||||||
|
@ -403,13 +404,12 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
initData(testCase) {
|
initData(testCase) {
|
||||||
this.result = this.$post('/test/review/case/list/all', this.searchParam, response => {
|
this.result = this.$post('/test/review/case/list/ids', this.searchParam, response => {
|
||||||
this.testCases = response.data;
|
this.testCases = response.data;
|
||||||
for (let i = 0; i < this.testCases.length; i++) {
|
for (let i = 0; i < this.testCases.length; i++) {
|
||||||
if (this.testCases[i].id === testCase.id) {
|
if (this.testCases[i].id === testCase.id) {
|
||||||
this.index = i;
|
this.index = i;
|
||||||
this.getTestCase(i);
|
this.getTestCase(i);
|
||||||
this.getRelatedTest();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -439,9 +439,6 @@ export default {
|
||||||
}).length > 0;
|
}).length > 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleDelete() {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit a22a3005d9bd254793fcf634d72539cbdf31be3a
|
Subproject commit 8a972a198775b3783ed6e4cef27197e53d1ebdc8
|
Loading…
Reference in New Issue