This commit is contained in:
chenjianxing 2020-12-24 15:09:06 +08:00
commit a33126bb1e
18 changed files with 112 additions and 118 deletions

View File

@ -204,13 +204,10 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
} }
} }
ApiScenarioReport savedReport = apiScenarioReportService.get(testId); ApiScenarioReport savedReport = apiScenarioReportService.get(testId);
String scenarioID = null; String scenarioID = "";
if(savedReport!=null){ if(savedReport!=null){
scenarioID = savedReport.getScenarioId(); scenarioID = savedReport.getScenarioId();
} }
if(scenarioID==null){
scenarioID = apiScenarioReportService.getApiScenarioId(scenaName, scenarioReport.getProjectId());
}
testResult.setTestId(scenarioID); testResult.setTestId(scenarioID);
} else { } else {

View File

@ -88,7 +88,18 @@ public class ApiDefinitionExecResultService {
if (startTime == null) { if (startTime == null) {
return new ArrayList<>(0); return new ArrayList<>(0);
} else { } else {
return extApiDefinitionExecResultMapper.findFaliureCaseInfoByProjectIDAndExecuteTimeAndLimitNumber(projectId, startTime.getTime(), limitNumber); List<ExecutedCaseInfoResult>list = extApiDefinitionExecResultMapper.findFaliureCaseInfoByProjectIDAndExecuteTimeAndLimitNumber(projectId, startTime.getTime());
List<ExecutedCaseInfoResult> returnList = new ArrayList<>(limitNumber);
for(int i = 0;i<list.size();i++){
if(i<limitNumber){
returnList.add(list.get(i));
}else {
break;
}
}
return returnList;
} }
} }
} }

View File

@ -19,6 +19,6 @@ public interface ExtApiDefinitionExecResultMapper {
long countByTestCaseIDInProject(String projectId); long countByTestCaseIDInProject(String projectId);
List<ExecutedCaseInfoResult> findFaliureCaseInfoByProjectIDAndExecuteTimeAndLimitNumber(@Param("projectId") String projectId, @Param("startTimestamp") long startTimestamp, @Param("limitNumber") int limitNumber); List<ExecutedCaseInfoResult> findFaliureCaseInfoByProjectIDAndExecuteTimeAndLimitNumber(@Param("projectId") String projectId, @Param("startTimestamp") long startTimestamp);
} }

View File

@ -65,10 +65,9 @@
GROUP BY apiScene.api_scenario_id GROUP BY apiScene.api_scenario_id
)apiScene ON apiScene.api_scenario_id = scene.id )apiScene ON apiScene.api_scenario_id = scene.id
WHERE report.project_id = #{projectId} WHERE report.project_id = #{projectId}
AND report.status = 'Error' AND report.create_time >= #{startTimestamp} AND ( report.STATUS = 'Error' OR report.STATUS = 'Fail' ) AND report.create_time >= #{startTimestamp}
GROUP BY scene.id GROUP BY scene.id
) showTable ) showTable
ORDER BY showTable.failureTimes DESC ORDER BY showTable.failureTimes DESC
limit #{limitNumber}
</select> </select>
</mapper> </mapper>

View File

@ -115,11 +115,11 @@
</update> </update>
<select id="countByProjectID" resultType="java.lang.Long"> <select id="countByProjectID" resultType="java.lang.Long">
SELECT COUNT(id) AS countNumber FROM api_scenario WHERE project_id = #{0} SELECT COUNT(id) AS countNumber FROM api_scenario WHERE project_id = #{0} AND status != 'Trash'
</select> </select>
<select id="countByProjectIDAndCreatInThisWeek" resultType="java.lang.Long"> <select id="countByProjectIDAndCreatInThisWeek" resultType="java.lang.Long">
SELECT count(id) AS countNumber FROM api_scenario SELECT count(id) AS countNumber FROM api_scenario
WHERE project_id = #{projectId} WHERE project_id = #{projectId} AND status != 'Trash'
AND create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp} AND create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp}
</select> </select>

View File

@ -34,7 +34,7 @@
<el-tab-pane name="add"> <el-tab-pane name="add">
<template v-slot:label> <template v-slot:label>
<el-button type="primary" plain icon="el-icon-plus" size="mini"/> <el-button type="primary" plain icon="el-icon-plus" size="mini" v-tester/>
</template> </template>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>

View File

@ -38,7 +38,7 @@
import MsApiReportExport from "./ApiReportExport"; import MsApiReportExport from "./ApiReportExport";
import MsApiReportViewHeader from "./ApiReportViewHeader"; import MsApiReportViewHeader from "./ApiReportViewHeader";
import {RequestFactory} from "../../definition/model/ApiTestModel"; import {RequestFactory} from "../../definition/model/ApiTestModel";
import {windowPrint} from "@/common/js/utils"; import {windowPrint, getCurrentProjectID} from "@/common/js/utils";
export default { export default {
name: "MsApiReport", name: "MsApiReport",
@ -166,16 +166,9 @@
this.$warning(this.$t('api_test.automation.report_name_info')); this.$warning(this.$t('api_test.automation.report_name_info'));
return; return;
} }
if (!this.currentProjectId) {
this.$warning(this.$t('api_test.select_project'));
return;
}
this.loading = true; this.loading = true;
this.report.projectId = this.currentProjectId; this.report.projectId = getCurrentProjectID();
let url = "/api/scenario/report/add"; let url = "/api/scenario/report/update";
if (this.infoDb === true) {
url = "/api/scenario/report/update";
}
this.result = this.$post(url, this.report, response => { this.result = this.$post(url, this.report, response => {
this.$success(this.$t('commons.save_success')); this.$success(this.$t('commons.save_success'));
this.loading = false; this.loading = false;

View File

@ -50,14 +50,14 @@
<el-table-column :label="$t('commons.operating')" width="200px" v-if="!referenced"> <el-table-column :label="$t('commons.operating')" width="200px" v-if="!referenced">
<template v-slot:default="{row}"> <template v-slot:default="{row}">
<div v-if="trashEnable"> <div v-if="trashEnable">
<el-button type="text" @click="reductionApi(row)">恢复</el-button> <el-button type="text" @click="reductionApi(row)" v-tester>{{$t('commons.reduction')}}</el-button>
<el-button type="text" @click="remove(row)">{{ $t('api_test.automation.remove') }}</el-button> <el-button type="text" @click="remove(row)" v-tester>{{ $t('api_test.automation.remove') }}</el-button>
</div> </div>
<div v-else> <div v-else>
<el-button type="text" @click="edit(row)">{{ $t('api_test.automation.edit') }}</el-button> <el-button type="text" @click="edit(row)" v-tester>{{ $t('api_test.automation.edit') }}</el-button>
<el-button type="text" @click="execute(row)">{{ $t('api_test.automation.execute') }}</el-button> <el-button type="text" @click="execute(row)" v-tester>{{ $t('api_test.automation.execute') }}</el-button>
<el-button type="text" @click="copy(row)">{{ $t('api_test.automation.copy') }}</el-button> <el-button type="text" @click="copy(row)" v-tester>{{ $t('api_test.automation.copy') }}</el-button>
<el-button type="text" @click="remove(row)">{{ $t('api_test.automation.remove') }}</el-button> <el-button type="text" @click="remove(row)" v-tester>{{ $t('api_test.automation.remove') }}</el-button>
<ms-scenario-extend-buttons :row="row"/> <ms-scenario-extend-buttons :row="row"/>
</div> </div>
</template> </template>
@ -161,7 +161,7 @@
if (this.projectId != null) { if (this.projectId != null) {
this.condition.projectId = this.projectId; this.condition.projectId = this.projectId;
} }
this.selection = [];
let url = "/api/automation/list/" + this.currentPage + "/" + this.pageSize; let url = "/api/automation/list/" + this.currentPage + "/" + this.pageSize;
this.$post(url, this.condition, response => { this.$post(url, this.condition, response => {
let data = response.data; let data = response.data;

View File

@ -18,7 +18,7 @@
<el-input class="module-input" :placeholder="$t('test_track.module.search')" v-model="condition.filterText" <el-input class="module-input" :placeholder="$t('test_track.module.search')" v-model="condition.filterText"
size="small"> size="small">
<template v-slot:append> <template v-slot:append>
<el-button icon="el-icon-folder-add" @click="addScenario"/> <el-button icon="el-icon-folder-add" @click="addScenario" v-tester/>
</template> </template>
</el-input> </el-input>
<module-trash-button v-if="!isReadOnly" :condition="condition" :exe="enableTrash"/> <module-trash-button v-if="!isReadOnly" :condition="condition" :exe="enableTrash"/>

View File

@ -17,7 +17,7 @@
<ms-main-container> <ms-main-container>
<el-dropdown size="small" split-button type="primary" class="ms-api-buttion" <el-dropdown size="small" split-button type="primary" class="ms-api-buttion"
@click="handleCommand('ADD')" @click="handleCommand('ADD')"
@command="handleCommand"> @command="handleCommand" v-tester>
{{$t('commons.add')}} {{$t('commons.add')}}
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item command="debug">{{$t('api_test.definition.request.fast_debug')}}</el-dropdown-item> <el-dropdown-item command="debug">{{$t('api_test.definition.request.fast_debug')}}</el-dropdown-item>
@ -249,7 +249,6 @@
downloadFile("导出API.json", JSON.stringify(obj)); downloadFile("导出API.json", JSON.stringify(obj));
} else { } else {
let condition = {}; let condition = {};
if (this.isApiListEnable) {
let url = "/api/definition/list/1/100000"; let url = "/api/definition/list/1/100000";
condition.filters = ["Prepare", "Underway", "Completed"]; condition.filters = ["Prepare", "Underway", "Completed"];
condition.projectId = getCurrentProjectID(); condition.projectId = getCurrentProjectID();
@ -257,14 +256,6 @@
obj.data = response.data.listObject; obj.data = response.data.listObject;
downloadFile("导出API.json", JSON.stringify(obj)); 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));
});
}
} }
}, },
refresh(data) { refresh(data) {

View File

@ -42,7 +42,7 @@
</el-col> </el-col>
<el-col :span="2" v-if="!(isReadOnly || isCaseEdit)"> <el-col :span="2" v-if="!(isReadOnly || isCaseEdit)">
<el-dropdown size="small" split-button type="primary" class="ms-api-header-select" @click="addCase" <el-dropdown size="small" split-button type="primary" class="ms-api-header-select" @click="addCase"
@command="handleCommand"> @command="handleCommand" v-tester>
+{{$t('api_test.definition.request.case')}} +{{$t('api_test.definition.request.case')}}
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item command="run">{{$t('commons.test')}}</el-dropdown-item> <el-dropdown-item command="run">{{$t('commons.test')}}</el-dropdown-item>

View File

@ -19,7 +19,7 @@
@blur="saveTestCase(apiCase)" placeholder="请输入用例名称"/> @blur="saveTestCase(apiCase)" placeholder="请输入用例名称"/>
<span v-else> <span v-else>
{{apiCase.id ? apiCase.name:''}} {{apiCase.id ? apiCase.name:''}}
<i class="el-icon-edit" style="cursor:pointer" @click="showInput(apiCase)"/> <i class="el-icon-edit" style="cursor:pointer" @click="showInput(apiCase)" v-tester/>
</span> </span>
<div v-if="apiCase.id" style="color: #999999;font-size: 12px"> <div v-if="apiCase.id" style="color: #999999;font-size: 12px">
<span> <span>
@ -35,12 +35,12 @@
<el-col :span="4"> <el-col :span="4">
<ms-tip-button @click="singleRun(apiCase)" :tip="$t('api_test.run')" icon="el-icon-video-play" <ms-tip-button @click="singleRun(apiCase)" :tip="$t('api_test.run')" icon="el-icon-video-play"
style="background-color: #409EFF;color: white" size="mini" :disabled="!apiCase.id" circle/> style="background-color: #409EFF;color: white" size="mini" :disabled="!apiCase.id" circle v-tester/>
<ms-tip-button @click="copyCase(apiCase)" :tip="$t('commons.copy')" icon="el-icon-document-copy" <ms-tip-button @click="copyCase(apiCase)" :tip="$t('commons.copy')" icon="el-icon-document-copy"
size="mini" :disabled="!apiCase.id || isCaseEdit" circle/> size="mini" :disabled="!apiCase.id || isCaseEdit" circle v-tester/>
<ms-tip-button @click="deleteCase(index,apiCase)" :tip="$t('commons.delete')" icon="el-icon-delete" <ms-tip-button @click="deleteCase(index,apiCase)" :tip="$t('commons.delete')" icon="el-icon-delete"
size="mini" :disabled="!apiCase.id || isCaseEdit" circle/> size="mini" :disabled="!apiCase.id || isCaseEdit" circle v-tester/>
<ms-api-extend-btns :is-case-edit="isCaseEdit" :row="apiCase"/> <ms-api-extend-btns :is-case-edit="isCaseEdit" :row="apiCase" v-tester/>
</el-col> </el-col>
<el-col :span="3"> <el-col :span="3">
@ -64,7 +64,7 @@
<ms-sql-basis-parameters :request="apiCase.request" v-if="api.protocol==='SQL'"/> <ms-sql-basis-parameters :request="apiCase.request" v-if="api.protocol==='SQL'"/>
<ms-dubbo-basis-parameters :request="apiCase.request" v-if="api.protocol==='DUBBO'"/> <ms-dubbo-basis-parameters :request="apiCase.request" v-if="api.protocol==='DUBBO'"/>
<!-- 保存操作 --> <!-- 保存操作 -->
<el-button type="primary" size="small" style="margin: 20px; float: right" @click="saveTestCase(apiCase)"> <el-button type="primary" size="small" style="margin: 20px; float: right" @click="saveTestCase(apiCase)" v-tester>
{{$t('commons.save')}} {{$t('commons.save')}}
</el-button> </el-button>
</div> </div>

View File

@ -69,7 +69,7 @@
<el-table-column v-if="!isReadOnly && !isRelevanceModel" :label="$t('commons.operating')" min-width="130" align="center"> <el-table-column v-if="!isReadOnly && !isRelevanceModel" :label="$t('commons.operating')" min-width="130" align="center">
<template v-slot:default="scope"> <template v-slot:default="scope">
<!--<el-button type="text" @click="reductionApi(scope.row)" v-if="trashEnable">恢复</el-button>--> <!--<el-button type="text" @click="reductionApi(scope.row)" v-if="trashEnable">{{$t('commons.reduction')}}</el-button>-->
<el-button type="text" @click="handleTestCase(scope.row)" v-if="!trashEnable">{{$t('commons.edit')}}</el-button> <el-button type="text" @click="handleTestCase(scope.row)" v-if="!trashEnable">{{$t('commons.edit')}}</el-button>
<el-button type="text" @click="handleDelete(scope.row)" style="color: #F56C6C">{{$t('commons.delete')}}</el-button> <el-button type="text" @click="handleDelete(scope.row)" style="color: #F56C6C">{{$t('commons.delete')}}</el-button>
</template> </template>

View File

@ -78,10 +78,10 @@
<el-table-column v-if="!isReadOnly && !isRelevance" :label="$t('commons.operating')" min-width="130" align="center"> <el-table-column v-if="!isReadOnly && !isRelevance" :label="$t('commons.operating')" min-width="130" align="center">
<template v-slot:default="scope"> <template v-slot:default="scope">
<el-button type="text" @click="reductionApi(scope.row)" v-if="trashEnable">恢复</el-button> <el-button type="text" @click="reductionApi(scope.row)" v-if="trashEnable" v-tester>{{$t('commons.reduction')}}</el-button>
<el-button type="text" @click="editApi(scope.row)" v-else>{{$t('commons.edit')}}</el-button> <el-button type="text" @click="editApi(scope.row)" v-else v-tester>{{$t('commons.edit')}}</el-button>
<el-button type="text" @click="handleTestCase(scope.row)">{{$t('api_test.definition.request.case')}}</el-button> <el-button type="text" @click="handleTestCase(scope.row)">{{$t('api_test.definition.request.case')}}</el-button>
<el-button type="text" @click="handleDelete(scope.row)" style="color: #F56C6C">{{$t('commons.delete')}}</el-button> <el-button type="text" @click="handleDelete(scope.row)" style="color: #F56C6C" v-tester>{{$t('commons.delete')}}</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>

@ -1 +1 @@
Subproject commit 010ad7a5f072a5e9d368c756a2473bbd20781433 Subproject commit 8cda5c873cd9985c97adb34efacf507167fa4182

View File

@ -65,6 +65,7 @@ export default {
refresh: 'Refresh', refresh: 'Refresh',
remark: 'Remark', remark: 'Remark',
delete: 'Delete', delete: 'Delete',
reduction: 'Reduction',
not_filled: 'Not filled', not_filled: 'Not filled',
please_select: 'Please select', please_select: 'Please select',
search_by_name: 'Search by name', search_by_name: 'Search by name',

View File

@ -65,6 +65,7 @@ export default {
refresh: '刷新', refresh: '刷新',
remark: '备注', remark: '备注',
delete: '删除', delete: '删除',
reduction: '恢复',
not_filled: '未填写', not_filled: '未填写',
please_select: '请选择', please_select: '请选择',
search_by_name: '根据名称搜索', search_by_name: '根据名称搜索',

View File

@ -65,6 +65,7 @@ export default {
refresh: '刷新', refresh: '刷新',
remark: '備註', remark: '備註',
delete: '刪除', delete: '刪除',
reduction: '恢复',
not_filled: '未填寫', not_filled: '未填寫',
please_select: '請選擇', please_select: '請選擇',
search_by_name: '根據名稱搜索', search_by_name: '根據名稱搜索',
@ -796,88 +797,88 @@ export default {
suffixFormatErr: "文件格式不符合要求", suffixFormatErr: "文件格式不符合要求",
swagger_url_import: "使用URL導入", swagger_url_import: "使用URL導入",
}, },
home_page:{ home_page: {
unit_of_measurement:"個", unit_of_measurement: "個",
api_count_card:{ api_count_card: {
title: "接口數量統計", title: "接口數量統計",
}, },
test_case_count_card:{ test_case_count_card: {
title: "接口用例數量統計", title: "接口用例數量統計",
}, },
test_scene_count_card:{ test_scene_count_card: {
title: "場景用例數量統計", title: "場景用例數量統計",
}, },
schedule_task_count_card:{ schedule_task_count_card: {
title: "定時任務數量統計", title: "定時任務數量統計",
}, },
detail_card:{ detail_card: {
running:"進行中", running: "進行中",
not_started:"未開始", not_started: "未開始",
finished:"已完成", finished: "已完成",
uncoverage:"未覆蓋", uncoverage: "未覆蓋",
coverage:"已覆蓋", coverage: "已覆蓋",
unexecute:"未執行", unexecute: "未執行",
execution_failed:"未通過", execution_failed: "未通過",
execution_pass:"已通過", execution_pass: "已通過",
failed:"失敗", failed: "失敗",
success:"成功", success: "成功",
rate:{ rate: {
completion:"完成率", completion: "完成率",
coverage:"覆蓋率", coverage: "覆蓋率",
pass:"通過率", pass: "通過率",
success:"成功率", success: "成功率",
}, },
}, },
api_details_card:{ api_details_card: {
title: "接口", title: "接口",
this_week_add:"本週新增: {0}个", this_week_add: "本週新增: {0}个",
}, },
test_case_details_card:{ test_case_details_card: {
title: "用例", title: "用例",
this_week_add:"本週新增: {0}个", this_week_add: "本週新增: {0}个",
this_week_execute:"本週執行: {0}次", this_week_execute: "本週執行: {0}次",
executed:"歷史總執行: {0}次", executed: "歷史總執行: {0}次",
this_week_add_sm:"本週新增:<br/>{0}个", this_week_add_sm: "本週新增:<br/>{0}个",
this_week_execute_sm:"本週執行:<br/>{0}次", this_week_execute_sm: "本週執行:<br/>{0}次",
executed_sm:"歷史總執行:<br/>{0}次", executed_sm: "歷史總執行:<br/>{0}次",
}, },
test_scene_details_card:{ test_scene_details_card: {
title: "場景", title: "場景",
this_week_add:"本週新增: {0}个", this_week_add: "本週新增: {0}个",
this_week_execute:"本週執行: {0}次", this_week_execute: "本週執行: {0}次",
executed:"歷史總執行: {0}次", executed: "歷史總執行: {0}次",
this_week_add_sm:"本週新增:<br/>{0}个", this_week_add_sm: "本週新增:<br/>{0}个",
this_week_execute_sm:"本週執行:<br/>{0}次", this_week_execute_sm: "本週執行:<br/>{0}次",
executed_sm:"歷史總執行:<br/>{0}次", executed_sm: "歷史總執行:<br/>{0}次",
}, },
schedule_task_details_card:{ schedule_task_details_card: {
title: "定時任務", title: "定時任務",
this_week_add:"本週新增: {0}个", this_week_add: "本週新增: {0}个",
this_week_execute:"本週執行: {0}次", this_week_execute: "本週執行: {0}次",
executed:"歷史總執行: {0}次", executed: "歷史總執行: {0}次",
this_week_add_sm:"本週新增:<br/>{0}个", this_week_add_sm: "本週新增:<br/>{0}个",
this_week_execute_sm:"本週執行:<br/>{0}次", this_week_execute_sm: "本週執行:<br/>{0}次",
executed_sm:"歷史總執行:<br/>{0}次", executed_sm: "歷史總執行:<br/>{0}次",
}, },
failed_case_list:{ failed_case_list: {
title: "過去7天測試計畫失敗用例TOP 10", title: "過去7天測試計畫失敗用例TOP 10",
table_coloum:{ table_coloum: {
index: "排名", index: "排名",
case_name: "用例名稱", case_name: "用例名稱",
case_type: "用例類型", case_type: "用例類型",
test_plan: "所屬測試計畫", test_plan: "所屬測試計畫",
failure_times: "失敗次數", failure_times: "失敗次數",
}, },
table_value:{ table_value: {
case_type:{ case_type: {
api: "接口用例", api: "接口用例",
scene: "場景用例", scene: "場景用例",
} }
} }
}, },
running_task_list:{ running_task_list: {
title: "運行中的定時任務", title: "運行中的定時任務",
table_coloum:{ table_coloum: {
index: "序號", index: "序號",
scenario: "場景名稱", scenario: "場景名稱",
run_rule: "運行規則", run_rule: "運行規則",
@ -886,7 +887,7 @@ export default {
create_user: "創建人", create_user: "創建人",
update_time: "更新時間", update_time: "更新時間",
}, },
confirm:{ confirm: {
close_title: "要關閉這條定時任務嗎?", close_title: "要關閉這條定時任務嗎?",
} }
} }