diff --git a/backend/src/main/java/io/metersphere/api/jmeter/APIBackendListenerClient.java b/backend/src/main/java/io/metersphere/api/jmeter/APIBackendListenerClient.java index 66f71dc3f3..b4abea3e3d 100644 --- a/backend/src/main/java/io/metersphere/api/jmeter/APIBackendListenerClient.java +++ b/backend/src/main/java/io/metersphere/api/jmeter/APIBackendListenerClient.java @@ -204,13 +204,10 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl } } ApiScenarioReport savedReport = apiScenarioReportService.get(testId); - String scenarioID = null; + String scenarioID = ""; if(savedReport!=null){ scenarioID = savedReport.getScenarioId(); } - if(scenarioID==null){ - scenarioID = apiScenarioReportService.getApiScenarioId(scenaName, scenarioReport.getProjectId()); - } testResult.setTestId(scenarioID); } else { diff --git a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionExecResultService.java b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionExecResultService.java index 8ec808f47c..3412cd9767 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionExecResultService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionExecResultService.java @@ -88,7 +88,18 @@ public class ApiDefinitionExecResultService { if (startTime == null) { return new ArrayList<>(0); } else { - return extApiDefinitionExecResultMapper.findFaliureCaseInfoByProjectIDAndExecuteTimeAndLimitNumber(projectId, startTime.getTime(), limitNumber); + Listlist = extApiDefinitionExecResultMapper.findFaliureCaseInfoByProjectIDAndExecuteTimeAndLimitNumber(projectId, startTime.getTime()); + + List returnList = new ArrayList<>(limitNumber); + for(int i = 0;i findFaliureCaseInfoByProjectIDAndExecuteTimeAndLimitNumber(@Param("projectId") String projectId, @Param("startTimestamp") long startTimestamp, @Param("limitNumber") int limitNumber); + List findFaliureCaseInfoByProjectIDAndExecuteTimeAndLimitNumber(@Param("projectId") String projectId, @Param("startTimestamp") long startTimestamp); } \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionExecResultMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionExecResultMapper.xml index a9a3e67c11..0fa037c30c 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionExecResultMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionExecResultMapper.xml @@ -52,9 +52,9 @@ UNION SELECT scene.`name` AS caseName,apiScene.testPlanName AS testPlan,count(report.id) AS failureTimes,'scenario' AS caseType FROM api_scenario_report report - INNER JOIN api_scenario_report_detail reportDetail ON report.id = reportDetail.report_id - INNER JOIN api_scenario scene ON report.scenario_id = scene.id - LEFT JOIN + INNER JOIN api_scenario_report_detail reportDetail ON report.id = reportDetail.report_id + INNER JOIN api_scenario scene ON report.scenario_id = scene.id + LEFT JOIN ( SELECT apiScene.api_scenario_id, @@ -65,10 +65,9 @@ GROUP BY apiScene.api_scenario_id )apiScene ON apiScene.api_scenario_id = scene.id WHERE report.project_id = #{projectId} - AND report.status = 'Error' AND report.create_time >= #{startTimestamp} - GROUP BY scene.id + AND ( report.STATUS = 'Error' OR report.STATUS = 'Fail' ) AND report.create_time >= #{startTimestamp} + GROUP BY scene.id ) showTable ORDER BY showTable.failureTimes DESC - limit #{limitNumber} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml index c6d513502e..d4b91553d2 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml @@ -115,11 +115,11 @@ diff --git a/frontend/src/business/components/api/automation/ApiAutomation.vue b/frontend/src/business/components/api/automation/ApiAutomation.vue index d1ed00a250..f294010f61 100644 --- a/frontend/src/business/components/api/automation/ApiAutomation.vue +++ b/frontend/src/business/components/api/automation/ApiAutomation.vue @@ -34,7 +34,7 @@ diff --git a/frontend/src/business/components/api/automation/report/ApiReportDetail.vue b/frontend/src/business/components/api/automation/report/ApiReportDetail.vue index 80efadb5fb..48457f01cf 100644 --- a/frontend/src/business/components/api/automation/report/ApiReportDetail.vue +++ b/frontend/src/business/components/api/automation/report/ApiReportDetail.vue @@ -12,10 +12,10 @@ - - - - + + + + @@ -38,7 +38,7 @@ import MsApiReportExport from "./ApiReportExport"; import MsApiReportViewHeader from "./ApiReportViewHeader"; import {RequestFactory} from "../../definition/model/ApiTestModel"; - import {windowPrint} from "@/common/js/utils"; + import {windowPrint, getCurrentProjectID} from "@/common/js/utils"; export default { name: "MsApiReport", @@ -166,16 +166,9 @@ this.$warning(this.$t('api_test.automation.report_name_info')); return; } - if (!this.currentProjectId) { - this.$warning(this.$t('api_test.select_project')); - return; - } this.loading = true; - this.report.projectId = this.currentProjectId; - let url = "/api/scenario/report/add"; - if (this.infoDb === true) { - url = "/api/scenario/report/update"; - } + this.report.projectId = getCurrentProjectID(); + let url = "/api/scenario/report/update"; this.result = this.$post(url, this.report, response => { this.$success(this.$t('commons.save_success')); this.loading = false; diff --git a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue index 34fc1f7703..6285b48fd6 100644 --- a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue +++ b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue @@ -50,14 +50,14 @@ @@ -161,7 +161,7 @@ if (this.projectId != null) { this.condition.projectId = this.projectId; } - + this.selection = []; let url = "/api/automation/list/" + this.currentPage + "/" + this.pageSize; this.$post(url, this.condition, response => { let data = response.data; diff --git a/frontend/src/business/components/api/automation/scenario/ApiScenarioModule.vue b/frontend/src/business/components/api/automation/scenario/ApiScenarioModule.vue index b2b2721423..a4569c516c 100644 --- a/frontend/src/business/components/api/automation/scenario/ApiScenarioModule.vue +++ b/frontend/src/business/components/api/automation/scenario/ApiScenarioModule.vue @@ -18,7 +18,7 @@ diff --git a/frontend/src/business/components/api/definition/ApiDefinition.vue b/frontend/src/business/components/api/definition/ApiDefinition.vue index 07b04908a7..243f952bc0 100644 --- a/frontend/src/business/components/api/definition/ApiDefinition.vue +++ b/frontend/src/business/components/api/definition/ApiDefinition.vue @@ -17,7 +17,7 @@ + @command="handleCommand" v-tester> {{$t('commons.add')}} {{$t('api_test.definition.request.fast_debug')}} @@ -249,22 +249,13 @@ downloadFile("导出API.json", JSON.stringify(obj)); } else { let condition = {}; - if (this.isApiListEnable) { - let url = "/api/definition/list/1/100000"; - condition.filters = ["Prepare", "Underway", "Completed"]; - condition.projectId = getCurrentProjectID(); - this.$post(url, condition, response => { - obj.data = response.data.listObject; - downloadFile("导出API.json", JSON.stringify(obj)); - }); - } else { - let url = "/api/testcase/list/"; - condition.projectId = getCurrentProjectID(); - this.$post(url, condition, response => { - obj.data = response.data; - downloadFile("导出API.json", JSON.stringify(obj)); - }); - } + let url = "/api/definition/list/1/100000"; + condition.filters = ["Prepare", "Underway", "Completed"]; + condition.projectId = getCurrentProjectID(); + this.$post(url, condition, response => { + obj.data = response.data.listObject; + downloadFile("导出API.json", JSON.stringify(obj)); + }); } }, refresh(data) { diff --git a/frontend/src/business/components/api/definition/components/case/ApiCaseHeader.vue b/frontend/src/business/components/api/definition/components/case/ApiCaseHeader.vue index 202c724d3d..409585c2df 100644 --- a/frontend/src/business/components/api/definition/components/case/ApiCaseHeader.vue +++ b/frontend/src/business/components/api/definition/components/case/ApiCaseHeader.vue @@ -42,7 +42,7 @@ + @command="handleCommand" v-tester> +{{$t('api_test.definition.request.case')}} {{$t('commons.test')}} 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 bd9a1ef149..9585e3dee7 100644 --- a/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue +++ b/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue @@ -19,7 +19,7 @@ @blur="saveTestCase(apiCase)" placeholder="请输入用例名称"/> {{apiCase.id ? apiCase.name:''}} - +
@@ -35,12 +35,12 @@ + style="background-color: #409EFF;color: white" size="mini" :disabled="!apiCase.id" circle v-tester/> + size="mini" :disabled="!apiCase.id || isCaseEdit" circle v-tester/> - + size="mini" :disabled="!apiCase.id || isCaseEdit" circle v-tester/> + @@ -64,7 +64,7 @@ - + {{$t('commons.save')}}
diff --git a/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue b/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue index 811a046091..b7fb27e434 100644 --- a/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue +++ b/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue @@ -69,7 +69,7 @@ diff --git a/frontend/src/business/components/api/definition/components/list/ApiList.vue b/frontend/src/business/components/api/definition/components/list/ApiList.vue index 0a178aeb12..d48521877f 100644 --- a/frontend/src/business/components/api/definition/components/list/ApiList.vue +++ b/frontend/src/business/components/api/definition/components/list/ApiList.vue @@ -78,10 +78,10 @@ diff --git a/frontend/src/business/components/xpack b/frontend/src/business/components/xpack index 010ad7a5f0..8cda5c873c 160000 --- a/frontend/src/business/components/xpack +++ b/frontend/src/business/components/xpack @@ -1 +1 @@ -Subproject commit 010ad7a5f072a5e9d368c756a2473bbd20781433 +Subproject commit 8cda5c873cd9985c97adb34efacf507167fa4182 diff --git a/frontend/src/i18n/en-US.js b/frontend/src/i18n/en-US.js index 5187d54e45..3f56be2f42 100644 --- a/frontend/src/i18n/en-US.js +++ b/frontend/src/i18n/en-US.js @@ -65,6 +65,7 @@ export default { refresh: 'Refresh', remark: 'Remark', delete: 'Delete', + reduction: 'Reduction', not_filled: 'Not filled', please_select: 'Please select', search_by_name: 'Search by name', diff --git a/frontend/src/i18n/zh-CN.js b/frontend/src/i18n/zh-CN.js index 062f3a0b36..7ba40156c0 100644 --- a/frontend/src/i18n/zh-CN.js +++ b/frontend/src/i18n/zh-CN.js @@ -65,6 +65,7 @@ export default { refresh: '刷新', remark: '备注', delete: '删除', + reduction: '恢复', not_filled: '未填写', please_select: '请选择', search_by_name: '根据名称搜索', diff --git a/frontend/src/i18n/zh-TW.js b/frontend/src/i18n/zh-TW.js index d5a75e8fd9..0546fb8d67 100644 --- a/frontend/src/i18n/zh-TW.js +++ b/frontend/src/i18n/zh-TW.js @@ -65,6 +65,7 @@ export default { refresh: '刷新', remark: '備註', delete: '刪除', + reduction: '恢复', not_filled: '未填寫', please_select: '請選擇', search_by_name: '根據名稱搜索', @@ -796,88 +797,88 @@ export default { suffixFormatErr: "文件格式不符合要求", swagger_url_import: "使用URL導入", }, - home_page:{ - unit_of_measurement:"個", - api_count_card:{ + home_page: { + unit_of_measurement: "個", + api_count_card: { title: "接口數量統計", }, - test_case_count_card:{ + test_case_count_card: { title: "接口用例數量統計", }, - test_scene_count_card:{ + test_scene_count_card: { title: "場景用例數量統計", }, - schedule_task_count_card:{ + schedule_task_count_card: { title: "定時任務數量統計", }, - detail_card:{ - running:"進行中", - not_started:"未開始", - finished:"已完成", - uncoverage:"未覆蓋", - coverage:"已覆蓋", - unexecute:"未執行", - execution_failed:"未通過", - execution_pass:"已通過", - failed:"失敗", - success:"成功", - rate:{ - completion:"完成率", - coverage:"覆蓋率", - pass:"通過率", - success:"成功率", + detail_card: { + running: "進行中", + not_started: "未開始", + finished: "已完成", + uncoverage: "未覆蓋", + coverage: "已覆蓋", + unexecute: "未執行", + execution_failed: "未通過", + execution_pass: "已通過", + failed: "失敗", + success: "成功", + rate: { + completion: "完成率", + coverage: "覆蓋率", + pass: "通過率", + success: "成功率", }, }, - api_details_card:{ + api_details_card: { title: "接口", - this_week_add:"本週新增: {0}个", + this_week_add: "本週新增: {0}个", }, - test_case_details_card:{ + test_case_details_card: { title: "用例", - this_week_add:"本週新增: {0}个", - this_week_execute:"本週執行: {0}次", - executed:"歷史總執行: {0}次", - this_week_add_sm:"本週新增:
{0}个", - this_week_execute_sm:"本週執行:
{0}次", - executed_sm:"歷史總執行:
{0}次", + this_week_add: "本週新增: {0}个", + this_week_execute: "本週執行: {0}次", + executed: "歷史總執行: {0}次", + this_week_add_sm: "本週新增:
{0}个", + this_week_execute_sm: "本週執行:
{0}次", + executed_sm: "歷史總執行:
{0}次", }, - test_scene_details_card:{ + test_scene_details_card: { title: "場景", - this_week_add:"本週新增: {0}个", - this_week_execute:"本週執行: {0}次", - executed:"歷史總執行: {0}次", - this_week_add_sm:"本週新增:
{0}个", - this_week_execute_sm:"本週執行:
{0}次", - executed_sm:"歷史總執行:
{0}次", + this_week_add: "本週新增: {0}个", + this_week_execute: "本週執行: {0}次", + executed: "歷史總執行: {0}次", + this_week_add_sm: "本週新增:
{0}个", + this_week_execute_sm: "本週執行:
{0}次", + executed_sm: "歷史總執行:
{0}次", }, - schedule_task_details_card:{ + schedule_task_details_card: { title: "定時任務", - this_week_add:"本週新增: {0}个", - this_week_execute:"本週執行: {0}次", - executed:"歷史總執行: {0}次", - this_week_add_sm:"本週新增:
{0}个", - this_week_execute_sm:"本週執行:
{0}次", - executed_sm:"歷史總執行:
{0}次", + this_week_add: "本週新增: {0}个", + this_week_execute: "本週執行: {0}次", + executed: "歷史總執行: {0}次", + this_week_add_sm: "本週新增:
{0}个", + this_week_execute_sm: "本週執行:
{0}次", + executed_sm: "歷史總執行:
{0}次", }, - failed_case_list:{ + failed_case_list: { title: "過去7天測試計畫失敗用例TOP 10", - table_coloum:{ + table_coloum: { index: "排名", case_name: "用例名稱", case_type: "用例類型", test_plan: "所屬測試計畫", failure_times: "失敗次數", }, - table_value:{ - case_type:{ + table_value: { + case_type: { api: "接口用例", scene: "場景用例", } } }, - running_task_list:{ + running_task_list: { title: "運行中的定時任務", - table_coloum:{ + table_coloum: { index: "序號", scenario: "場景名稱", run_rule: "運行規則", @@ -886,7 +887,7 @@ export default { create_user: "創建人", update_time: "更新時間", }, - confirm:{ + confirm: { close_title: "要關閉這條定時任務嗎?", } }