This commit is contained in:
fit2-zhao 2020-11-30 17:22:06 +08:00
commit 4facb91b34
5 changed files with 59 additions and 31 deletions

View File

@ -39,4 +39,12 @@ public interface ExtTestPlanTestCaseMapper {
List<TestPlanCaseDTO> listTestCaseByProjectIds(@Param("ids") List<String> ids); List<TestPlanCaseDTO> listTestCaseByProjectIds(@Param("ids") List<String> ids);
TestPlanCaseDTO get(String testPlanTestCaseId); TestPlanCaseDTO get(String testPlanTestCaseId);
/**
* 获取测试计划下的 TestPlanTestCaseID TestCaseName
* @param request planId 不能为空
* @return List<TestPlanCaseDTO>
*/
List<TestPlanCaseDTO> getTestPlanTestCaseList(@Param("request") QueryTestPlanCaseRequest request);
} }

View File

@ -121,7 +121,9 @@
</select> </select>
<select id="list" resultType="io.metersphere.track.dto.TestPlanCaseDTO"> <select id="list" resultType="io.metersphere.track.dto.TestPlanCaseDTO">
select test_case.remark, test_plan_test_case.id as id, test_plan_test_case.*,test_case.*,test_case_node.name as model, project.name as projectName select test_plan_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_plan_test_case.executor, test_plan_test_case.status,
test_plan_test_case.update_time, test_case_node.name as model, project.name as projectName, test_plan_test_case.plan_id as planId
from test_plan_test_case from test_plan_test_case
inner join test_case on test_plan_test_case.case_id = test_case.id inner join test_case on test_plan_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
@ -134,7 +136,8 @@
</include> </include>
</if> </if>
<if test="request.name != null"> <if test="request.name != null">
and (test_case.name like CONCAT('%', #{request.name},'%') or test_case.num like CONCAT('%', #{request.name},'%')) and (test_case.name like CONCAT('%', #{request.name},'%') or test_case.num like
CONCAT('%',#{request.name},'%'))
</if> </if>
<if test="request.id != null"> <if test="request.id != null">
and test_case.id = #{request.id} and test_case.id = #{request.id}
@ -210,6 +213,14 @@
</foreach> </foreach>
</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

View File

@ -785,7 +785,7 @@ public class JmeterDocumentParser implements DocumentParser {
threadGroup.appendChild(createStringProp(document, "LogFilename", "")); threadGroup.appendChild(createStringProp(document, "LogFilename", ""));
// bzm - Concurrency Thread Group "Thread Iterations Limit:" 设置为空 // bzm - Concurrency Thread Group "Thread Iterations Limit:" 设置为空
// threadGroup.appendChild(createStringProp(document, "Iterations", "1")); // threadGroup.appendChild(createStringProp(document, "Iterations", "1"));
threadGroup.appendChild(createStringProp(document, "Unit", "M")); threadGroup.appendChild(createStringProp(document, "Unit", "S"));
} }
private void processCheckoutTimer(Element element) { private void processCheckoutTimer(Element element) {
@ -912,7 +912,7 @@ public class JmeterDocumentParser implements DocumentParser {
} else { } else {
duration = (Integer) durations; duration = (Integer) durations;
} }
prop.getFirstChild().setNodeValue(String.valueOf(duration * 60)); prop.getFirstChild().setNodeValue(String.valueOf(duration));
continue; continue;
} }
Object rpsLimits = context.getProperty("rpsLimit"); Object rpsLimits = context.getProperty("rpsLimit");

View File

@ -83,6 +83,11 @@ public class TestPlanTestCaseController {
return testPlanTestCaseService.list(request); return testPlanTestCaseService.list(request);
} }
@PostMapping("/list/ids")
public List<TestPlanCaseDTO> getTestPlanCaseIds(@RequestBody QueryTestPlanCaseRequest request) {
return testPlanTestCaseService.list(request);
}
@PostMapping("/edit") @PostMapping("/edit")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR) @RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public void editTestCase(@RequestBody TestPlanTestCaseWithBLOBs testPlanTestCase) { public void editTestCase(@RequestBody TestPlanTestCaseWithBLOBs testPlanTestCase) {

View File

@ -473,26 +473,30 @@ export default {
}, },
getTestCase(index) { getTestCase(index) {
let testCase = this.testCases[index]; let testCase = this.testCases[index];
let item = {}; // id TestPlanTestCase id
Object.assign(item, testCase); this.result = this.$get('/test/plan/case/get/' + testCase.id, response => {
item.results = JSON.parse(item.results); let item = {};
item.steps = JSON.parse(item.steps); Object.assign(item, response.data);
if (item.issues) { item.results = JSON.parse(item.results);
item.issues = JSON.parse(item.issues); item.steps = JSON.parse(item.steps);
} else { if (item.issues) {
item.issues = {}; item.issues = JSON.parse(item.issues);
item.issues.hasIssues = false; } else {
} item.issues = {};
item.steptResults = [];
for (let i = 0; i < item.steps.length; i++) {
if (item.results[i]) {
item.steps[i].actualResult = item.results[i].actualResult;
item.steps[i].executeResult = item.results[i].executeResult;
} }
item.steptResults.push(item.steps[i]); item.steptResults = [];
} for (let i = 0; i < item.steps.length; i++) {
this.testCase = item; if (item.results[i]) {
this.initTest(); item.steps[i].actualResult = item.results[i].actualResult;
item.steps[i].executeResult = item.results[i].executeResult;
}
item.steptResults.push(item.steps[i]);
}
this.testCase = item;
this.getRelatedTest();
this.initTest();
})
this.getIssues(testCase.caseId); this.getIssues(testCase.caseId);
this.stepResultChange(); this.stepResultChange();
this.getFileMetaData(testCase); this.getFileMetaData(testCase);
@ -521,12 +525,13 @@ 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') {
if (this.$refs.apiTestDetail && this.testCase.type === 'api') {
this.$refs.apiTestDetail.init(); this.$refs.apiTestDetail.init();
} else if (this.testCase.type === 'performance') { } else if (this.testCase.type === 'performance') {
this.$refs.performanceTestDetail.init(); this.$refs.performanceTestDetail.init();
}
} }
} }
}); });
@ -546,13 +551,12 @@ export default {
this.$post('/test/plan/case/edit', {id: this.testCase.id, reportId: reportId}); this.$post('/test/plan/case/edit', {id: this.testCase.id, reportId: reportId});
}, },
initData(testCase) { initData(testCase) {
this.result = this.$post('/test/plan/case/list/all', this.searchParam, response => { this.result = this.$post('/test/plan/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();
} }
} }
}); });