diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/assertions/MsAssertions.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/assertions/MsAssertions.java index af6754e309..1dfbe65be0 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/assertions/MsAssertions.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/assertions/MsAssertions.java @@ -96,7 +96,7 @@ public class MsAssertions extends MsTestElement { assertion.setJsonValidationBool(true); assertion.setExpectNull(false); assertion.setInvert(false); - assertion.setIsRegex(false); + assertion.setIsRegex(true); return assertion; } diff --git a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java index c1badc7da4..2084a7eb85 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -157,17 +157,6 @@ public class ApiAutomationService { return request; } - - public List selectIdsNotExistsInPlan(String projectId, String planId) { - return extApiScenarioMapper.selectIdsNotExistsInPlan(projectId, planId); - } - - public void deleteByIds(List nodeIds) { - ApiScenarioExample example = new ApiScenarioExample(); - example.createCriteria().andApiScenarioModuleIdIn(nodeIds); - apiScenarioMapper.deleteByExample(example); - } - public void removeToGcByIds(List nodeIds) { ApiScenarioExample example = new ApiScenarioExample(); example.createCriteria().andApiScenarioModuleIdIn(nodeIds); @@ -387,7 +376,7 @@ public class ApiAutomationService { return report; } - private void pase(String scenarioDefinition, MsScenario scenario) { + private void parse(String scenarioDefinition, MsScenario scenario) { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); try { @@ -424,7 +413,7 @@ public class ApiAutomationService { if (planEnvMap.size() > 0) { scenario.setEnvironmentMap(planEnvMap); } - pase(item.getScenarioDefinition(), scenario); + parse(item.getScenarioDefinition(), scenario); group.setEnableCookieShare(scenario.isEnableCookieShare()); LinkedList scenarios = new LinkedList<>(); @@ -453,7 +442,7 @@ public class ApiAutomationService { if (scenario == null) { return null; } - pase(apiScenario.getScenarioDefinition(), scenario); + parse(apiScenario.getScenarioDefinition(), scenario); // 针对导入的jmx 处理 if (CollectionUtils.isNotEmpty(scenario.getHashTree()) && (scenario.getHashTree().get(0) instanceof MsJmeterElement)) { scenario.toHashTree(jmeterHashTree, scenario.getHashTree(), config); @@ -527,12 +516,13 @@ public class ApiAutomationService { report = createScenarioReport(reportId, item.getId(), item.getName(), request.getTriggerMode(), request.getExecuteType(), item.getProjectId(), request.getReportUserID()); } - //存储报告 - batchMapper.insert(report); // 生成报告和HashTree HashTree hashTree = generateHashTree(item, reportId, planEnvMap); + //存储报告 + batchMapper.insert(report); + // 调用执行方法 jMeterService.runDefinition(report.getId(), hashTree, request.getReportId(), request.getRunMode()); // 重置报告ID diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestReviewCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestReviewCaseMapper.xml index e0988937dc..00f773ad2b 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestReviewCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestReviewCaseMapper.xml @@ -100,7 +100,7 @@ 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 + project.name as projectName, test_case_review_test_case.review_id as reviewId,test_case.test_id as testId 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 diff --git a/backend/src/main/java/io/metersphere/track/controller/TestCaseReviewController.java b/backend/src/main/java/io/metersphere/track/controller/TestCaseReviewController.java index 6ea0f97fb8..a2e3b0daea 100644 --- a/backend/src/main/java/io/metersphere/track/controller/TestCaseReviewController.java +++ b/backend/src/main/java/io/metersphere/track/controller/TestCaseReviewController.java @@ -68,8 +68,8 @@ public class TestCaseReviewController { @PostMapping("/edit") @RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR) - public void editCaseReview(@RequestBody SaveTestCaseReviewRequest testCaseReview) { - testCaseReviewService.editCaseReview(testCaseReview); + public String editCaseReview(@RequestBody SaveTestCaseReviewRequest testCaseReview) { + return testCaseReviewService.editCaseReview(testCaseReview); } @GetMapping("/delete/{reviewId}") diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java index 2857fecd68..948ae0af0f 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java @@ -203,7 +203,7 @@ public class TestCaseReviewService { return extTestCaseReviewMapper.listByWorkspaceId(currentWorkspaceId, SessionUtils.getUserId(), SessionUtils.getCurrentProjectId()); } - public void editCaseReview(SaveTestCaseReviewRequest testCaseReview) { + public String editCaseReview(SaveTestCaseReviewRequest testCaseReview) { editCaseReviewer(testCaseReview); testCaseReview.setUpdateTime(System.currentTimeMillis()); checkCaseReviewExist(testCaseReview); @@ -221,6 +221,7 @@ public class TestCaseReviewService { .event(NoticeConstants.Event.UPDATE) .build(); noticeSendService.send(NoticeConstants.TaskType.REVIEW_TASK, noticeModel); + return testCaseReview.getId(); } private void editCaseReviewer(SaveTestCaseReviewRequest testCaseReview) { diff --git a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue index a75e44cc43..af479b9619 100644 --- a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue +++ b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue @@ -1,15 +1,18 @@ @@ -222,6 +230,7 @@ props: { moduleOptions: Array, currentScenario: {}, + type: String }, components: { MsVariableList, diff --git a/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue b/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue index bd54431588..76c6bb56f7 100644 --- a/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue +++ b/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue @@ -1,6 +1,6 @@ diff --git a/frontend/src/business/components/track/review/view/components/TestReviewTestCaseEdit.vue b/frontend/src/business/components/track/review/view/components/TestReviewTestCaseEdit.vue index 2760c085f3..55604d3485 100644 --- a/frontend/src/business/components/track/review/view/components/TestReviewTestCaseEdit.vue +++ b/frontend/src/business/components/track/review/view/components/TestReviewTestCaseEdit.vue @@ -39,11 +39,14 @@ + :disabled="isReadOnly" :icon="testCase.reviewStatus === 'Pass' ? 'el-icon-check' : ''" + @click="saveCase('Pass')"> {{ $t('test_track.review.pass') }} + :disabled="isReadOnly" + :icon="testCase.reviewStatus === 'UnPass' ? 'el-icon-check' : ''" + @click="saveCase('UnPass')"> {{ $t('test_track.review.un_pass') }} @@ -66,29 +69,22 @@ {{ $t('test_track.case.case_type') }}: - {{ - $t('commons.functional') - }} + + 场景用例 + {{ $t('commons.performance') }} {{ $t('commons.api') }} + 接口用例 + - - {{ $t('test_track.case.method') }}: - {{ $t('test_track.case.manual') }} - {{ $t('test_track.case.auto') }} - - + {{ $t('test_track.case.module') }}: {{ testCase.nodePath }} - - {{ $t('test_track.plan.plan_project') }}: - {{ testCase.projectName }} - @@ -98,7 +94,7 @@ - + @@ -108,12 +104,17 @@ :is-read-only="true" :id="testCase.testId" ref="performanceTestDetail"/> + + + - +
{{ $t('test_track.case.steps') }}: @@ -229,7 +230,8 @@ - +
@@ -248,9 +250,11 @@ import PerformanceTestDetail from "../../../plan/view/comonents/test/Performance import ApiTestResult from "../../../plan/view/comonents/test/ApiTestResult"; import ApiTestDetail from "../../../plan/view/comonents/test/ApiTestDetail"; import TestPlanTestCaseStatusButton from "../../../plan/common/TestPlanTestCaseStatusButton"; -import {listenGoBack, removeGoBackListener} from "@/common/js/utils"; +import {getCurrentProjectID, listenGoBack, removeGoBackListener} from "@/common/js/utils"; import ReviewComment from "../../commom/ReviewComment"; import TestCaseAttachment from "@/business/components/track/case/components/TestCaseAttachment"; +import ApiCaseItem from "@/business/components/api/definition/components/case/ApiCaseItem"; +import MsEditApiScenario from "@/business/components/api/automation/scenario/EditApiScenario" export default { name: "TestReviewTestCaseEdit", @@ -261,7 +265,10 @@ export default { ApiTestDetail, TestPlanTestCaseStatusButton, ReviewComment, - TestCaseAttachment + TestCaseAttachment, + ApiCaseItem, + MsEditApiScenario + }, data() { return { @@ -277,7 +284,11 @@ export default { users: [], activeName: 'comment', comments: [], - tableData: [] + tableData: [], + currentScenario: {}, + mark: 'detail', + api: {}, + apiCase: {}, }; }, props: { @@ -378,16 +389,55 @@ export default { listenGoBack(this.handleClose); this.initData(testCase); this.getComments(testCase); + this.getApiTestCase(testCase); + this.getCurrentScenario(testCase) + }, + getApiTestCase(testCase) { + let param = {} + param.projectId = getCurrentProjectID(); + param.id = testCase.testId; + this.result = this.$post("/api/testcase/list", param, response => { + let apiCaseList = [] + this.apiCaseList = response.data; + this.apiCaseList.forEach(apiCase => { + if (apiCase.tags && apiCase.tags.length > 0) { + apiCase.tags = JSON.parse(apiCase.tags); + this.$set(apiCase, 'selected', false); + } + if (Object.prototype.toString.call(apiCase.request).match(/\[object (\w+)\]/)[1].toLowerCase() != 'object') { + apiCase.request = JSON.parse(apiCase.request); + } + if (!apiCase.request.hashTree) { + apiCase.request.hashTree = []; + } + this.apiCase = apiCase + this.handleTestCase(apiCase) + }) + + }); + }, + getCurrentScenario(testCase) { + this.result = this.$get("/api/automation/getApiScenario/" + testCase.testId, response => { + this.currentScenario=response.data + }); + }, + + handleTestCase(testCase) { + this.$get('/api/definition/get/' + testCase.apiDefinitionId, (response) => { + this.api = response.data; + }); }, 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(); - } else if (this.testCase.type === 'performance') { - this.$refs.performanceTestDetail.init(); - } + if (this.$refs.apiTestDetail && this.testCase.type === 'api') { + this.$refs.apiTestDetail.init(); + } else if (this.testCase.type === 'performance') { + this.$refs.performanceTestDetail.init(); + } else if (this.testCase.type === 'testcase') { + this.$refs.apiCaseConfig.active(this.api); + } else if (this.testCase.type === 'automation') { + this.$refs.autoScenarioConfig.showAll(); } } }); diff --git a/frontend/src/business/components/track/review/view/components/TestReviewTestCaseList.vue b/frontend/src/business/components/track/review/view/components/TestReviewTestCaseList.vue index a3c5e0e88b..213b447120 100644 --- a/frontend/src/business/components/track/review/view/components/TestReviewTestCaseList.vue +++ b/frontend/src/business/components/track/review/view/components/TestReviewTestCaseList.vue @@ -84,7 +84,7 @@ - - + -->