refactor(测试跟踪): 用例评审查询优化
This commit is contained in:
parent
44e21cea8f
commit
439cf3b89b
|
@ -40,11 +40,4 @@ public interface ExtTestPlanTestCaseMapper {
|
|||
|
||||
TestPlanCaseDTO get(String testPlanTestCaseId);
|
||||
|
||||
/**
|
||||
* 获取测试计划下的 TestPlanTestCaseID 和 TestCaseName
|
||||
* @param request planId 不能为空
|
||||
* @return List<TestPlanCaseDTO>
|
||||
*/
|
||||
List<TestPlanCaseDTO> getTestPlanTestCaseList(@Param("request") QueryTestPlanCaseRequest request);
|
||||
|
||||
}
|
||||
|
|
|
@ -214,13 +214,6 @@
|
|||
</if>
|
||||
</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 distinct * from test_plan_test_case, test_case
|
||||
where test_plan_test_case.case_id = test_case.id
|
||||
|
|
|
@ -19,4 +19,11 @@ public interface ExtTestReviewCaseMapper {
|
|||
* @return List<TestReviewCaseDTO>
|
||||
*/
|
||||
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>
|
||||
|
||||
<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
|
||||
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
|
||||
|
@ -181,6 +184,15 @@
|
|||
</if>
|
||||
</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 review_status
|
||||
from test_case
|
||||
|
|
|
@ -61,6 +61,10 @@ public class CheckOwnerService {
|
|||
}
|
||||
|
||||
public void checkPerformanceTestOwner(String testId) {
|
||||
// 关联为其他时
|
||||
if (StringUtils.equals("other", testId)) {
|
||||
return;
|
||||
}
|
||||
String workspaceId = SessionUtils.getCurrentWorkspaceId();
|
||||
QueryTestPlanRequest request = new QueryTestPlanRequest();
|
||||
request.setWorkspaceId(workspaceId);
|
||||
|
|
|
@ -42,7 +42,7 @@ public class FileService {
|
|||
final List<LoadTestFile> loadTestFiles = loadTestFileMapper.selectByExample(loadTestFileExample);
|
||||
|
||||
if (CollectionUtils.isEmpty(loadTestFiles)) {
|
||||
return null;
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<String> fileIds = loadTestFiles.stream().map(LoadTestFile::getFileId).collect(Collectors.toList());
|
||||
FileMetadataExample example = new FileMetadataExample();
|
||||
|
|
|
@ -44,7 +44,7 @@ public class TestReviewTestCaseController {
|
|||
}
|
||||
|
||||
@PostMapping("/list/all")
|
||||
public List<TestReviewCaseDTO> getTestPlanCases(@RequestBody QueryCaseReviewRequest request) {
|
||||
public List<TestReviewCaseDTO> getTestReviewCases(@RequestBody QueryCaseReviewRequest request) {
|
||||
return testReviewTestCaseService.list(request);
|
||||
}
|
||||
|
||||
|
@ -53,4 +53,17 @@ public class TestReviewTestCaseController {
|
|||
public void editTestCase(@RequestBody TestCaseReviewTestCase 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());
|
||||
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);
|
||||
},
|
||||
getTestCase(index) {
|
||||
this.testCase = {};
|
||||
let testCase = this.testCases[index];
|
||||
// id 为 TestPlanTestCase 的 id
|
||||
this.result = this.$get('/test/plan/case/get/' + testCase.id, response => {
|
||||
|
@ -495,11 +496,10 @@ export default {
|
|||
this.testCase = item;
|
||||
this.getRelatedTest();
|
||||
this.initTest();
|
||||
})
|
||||
|
||||
this.getIssues(testCase.caseId);
|
||||
this.getIssues(item.caseId);
|
||||
this.stepResultChange();
|
||||
this.getFileMetaData(testCase);
|
||||
this.getFileMetaData(item);
|
||||
})
|
||||
},
|
||||
getFileMetaData(testCase) {
|
||||
this.tableData = [];
|
||||
|
|
|
@ -102,10 +102,11 @@
|
|||
<el-col class="test-detail" :span="20" :offset="1">
|
||||
<el-tabs v-model="activeTab" type="border-card">
|
||||
<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"/>
|
||||
<performance-test-detail :is-read-only="true" v-if="testCase.type === 'performance'"
|
||||
@runTest="testRun" :id="testCase.testId"
|
||||
<performance-test-detail v-if="testCase.type === 'performance'"
|
||||
:is-read-only="true"
|
||||
:id="testCase.testId"
|
||||
ref="performanceTestDetail"/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
@ -211,7 +212,6 @@
|
|||
<test-case-attachment :table-data="tableData"
|
||||
:read-only="false"
|
||||
:is-delete="false"
|
||||
@handleDelete="handleDelete"
|
||||
/>
|
||||
</div>
|
||||
</el-col>
|
||||
|
@ -338,9 +338,12 @@ export default {
|
|||
this.getTestCase(this.index);
|
||||
},
|
||||
getTestCase(index) {
|
||||
this.testCase = {};
|
||||
let testCase = this.testCases[index];
|
||||
this.result = this.$get("/test/review/case/get/" + testCase.id, response => {
|
||||
let item = {};
|
||||
Object.assign(item, testCase);
|
||||
let data = response.data;
|
||||
Object.assign(item, data);
|
||||
item.steps = JSON.parse(item.steps);
|
||||
item.steptResults = [];
|
||||
for (let i = 0; i < item.steps.length; i++) {
|
||||
|
@ -349,9 +352,12 @@ export default {
|
|||
item.steptResults.push(item.steps[i]);
|
||||
}
|
||||
this.testCase = item;
|
||||
this.getRelatedTest();
|
||||
this.getComments(item);
|
||||
this.initTest();
|
||||
this.getFileMetaData(testCase);
|
||||
this.getFileMetaData(data);
|
||||
})
|
||||
|
||||
},
|
||||
getFileMetaData(testCase) {
|
||||
this.tableData = [];
|
||||
|
@ -375,6 +381,7 @@ export default {
|
|||
},
|
||||
initTest() {
|
||||
this.$nextTick(() => {
|
||||
if (this.testCase.testId && this.testCase.testId !== 'other') {
|
||||
if (this.testCase.method === 'auto') {
|
||||
if (this.$refs.apiTestDetail && this.testCase.type === 'api') {
|
||||
this.$refs.apiTestDetail.init();
|
||||
|
@ -382,14 +389,8 @@ export default {
|
|||
this.$refs.performanceTestDetail.init();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
testRun(reportId) {
|
||||
this.testCase.reportId = reportId;
|
||||
this.saveReport(reportId);
|
||||
},
|
||||
saveReport(reportId) {
|
||||
|
||||
},
|
||||
getComments(testCase) {
|
||||
let id = '';
|
||||
|
@ -403,13 +404,12 @@ export default {
|
|||
})
|
||||
},
|
||||
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;
|
||||
for (let i = 0; i < this.testCases.length; i++) {
|
||||
if (this.testCases[i].id === testCase.id) {
|
||||
this.index = i;
|
||||
this.getTestCase(i);
|
||||
this.getRelatedTest();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -439,9 +439,6 @@ export default {
|
|||
}).length > 0;
|
||||
}
|
||||
},
|
||||
handleDelete() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit a22a3005d9bd254793fcf634d72539cbdf31be3a
|
||||
Subproject commit 8a972a198775b3783ed6e4cef27197e53d1ebdc8
|
Loading…
Reference in New Issue