This commit is contained in:
chenjianxing 2020-12-24 15:06:41 +08:00
commit bcbcfebe61
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);
String scenarioID = null;
String scenarioID = "";
if(savedReport!=null){
scenarioID = savedReport.getScenarioId();
}
if(scenarioID==null){
scenarioID = apiScenarioReportService.getApiScenarioId(scenaName, scenarioReport.getProjectId());
}
testResult.setTestId(scenarioID);
} else {

View File

@ -88,7 +88,18 @@ public class ApiDefinitionExecResultService {
if (startTime == null) {
return new ArrayList<>(0);
} 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);
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

@ -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}
</select>
</mapper>

View File

@ -115,11 +115,11 @@
</update>
<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 id="countByProjectIDAndCreatInThisWeek" resultType="java.lang.Long">
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}
</select>

View File

@ -34,7 +34,7 @@
<el-tab-pane name="add">
<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>
</el-tab-pane>
</el-tabs>

View File

@ -12,10 +12,10 @@
<ms-scenario-results :scenarios="content.scenarios" v-on:requestResult="requestResult"/>
</div>
<!--<el-collapse-transition>-->
<!--<div v-show="isActive" style="width: 99%">-->
<!--<ms-request-result-tail v-if="isRequestResult" :request-type="requestType" :request="request"-->
<!--:scenario-name="scenarioName"/>-->
<!--</div>-->
<!--<div v-show="isActive" style="width: 99%">-->
<!--<ms-request-result-tail v-if="isRequestResult" :request-type="requestType" :request="request"-->
<!--:scenario-name="scenarioName"/>-->
<!--</div>-->
<!--</el-collapse-transition>-->
<ms-api-report-export v-if="reportExportVisible" id="apiTestReport" :title="report.testName"
:content="content" :total-time="totalTime"/>
@ -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;

View File

@ -50,14 +50,14 @@
<el-table-column :label="$t('commons.operating')" width="200px" v-if="!referenced">
<template v-slot:default="{row}">
<div v-if="trashEnable">
<el-button type="text" @click="reductionApi(row)">恢复</el-button>
<el-button type="text" @click="remove(row)">{{ $t('api_test.automation.remove') }}</el-button>
<el-button type="text" @click="reductionApi(row)" v-tester>{{$t('commons.reduction')}}</el-button>
<el-button type="text" @click="remove(row)" v-tester>{{ $t('api_test.automation.remove') }}</el-button>
</div>
<div v-else>
<el-button type="text" @click="edit(row)">{{ $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="copy(row)">{{ $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="edit(row)" v-tester>{{ $t('api_test.automation.edit') }}</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)" v-tester>{{ $t('api_test.automation.copy') }}</el-button>
<el-button type="text" @click="remove(row)" v-tester>{{ $t('api_test.automation.remove') }}</el-button>
<ms-scenario-extend-buttons :row="row"/>
</div>
</template>
@ -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;

View File

@ -18,7 +18,7 @@
<el-input class="module-input" :placeholder="$t('test_track.module.search')" v-model="condition.filterText"
size="small">
<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>
</el-input>
<module-trash-button v-if="!isReadOnly" :condition="condition" :exe="enableTrash"/>

View File

@ -17,7 +17,7 @@
<ms-main-container>
<el-dropdown size="small" split-button type="primary" class="ms-api-buttion"
@click="handleCommand('ADD')"
@command="handleCommand">
@command="handleCommand" v-tester>
{{$t('commons.add')}}
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="debug">{{$t('api_test.definition.request.fast_debug')}}</el-dropdown-item>
@ -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) {

View File

@ -42,7 +42,7 @@
</el-col>
<el-col :span="2" v-if="!(isReadOnly || isCaseEdit)">
<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')}}
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="run">{{$t('commons.test')}}</el-dropdown-item>

View File

@ -19,7 +19,7 @@
@blur="saveTestCase(apiCase)" placeholder="请输入用例名称"/>
<span v-else>
{{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>
<div v-if="apiCase.id" style="color: #999999;font-size: 12px">
<span>
@ -35,12 +35,12 @@
<el-col :span="4">
<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"
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"
size="mini" :disabled="!apiCase.id || isCaseEdit" circle/>
<ms-api-extend-btns :is-case-edit="isCaseEdit" :row="apiCase"/>
size="mini" :disabled="!apiCase.id || isCaseEdit" circle v-tester/>
<ms-api-extend-btns :is-case-edit="isCaseEdit" :row="apiCase" v-tester/>
</el-col>
<el-col :span="3">
@ -64,7 +64,7 @@
<ms-sql-basis-parameters :request="apiCase.request" v-if="api.protocol==='SQL'"/>
<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')}}
</el-button>
</div>

View File

@ -69,7 +69,7 @@
<el-table-column v-if="!isReadOnly && !isRelevanceModel" :label="$t('commons.operating')" min-width="130" align="center">
<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="handleDelete(scope.row)" style="color: #F56C6C">{{$t('commons.delete')}}</el-button>
</template>

View File

@ -78,10 +78,10 @@
<el-table-column v-if="!isReadOnly && !isRelevance" :label="$t('commons.operating')" min-width="130" align="center">
<template v-slot:default="scope">
<el-button type="text" @click="reductionApi(scope.row)" v-if="trashEnable">恢复</el-button>
<el-button type="text" @click="editApi(scope.row)" v-else>{{$t('commons.edit')}}</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 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="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>
</el-table-column>
</el-table>

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

View File

@ -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',

View File

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

View File

@ -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:"本週新增:<br/>{0}个",
this_week_execute_sm:"本週執行:<br/>{0}次",
executed_sm:"歷史總執行:<br/>{0}次",
this_week_add: "本週新增: {0}个",
this_week_execute: "本週執行: {0}次",
executed: "歷史總執行: {0}次",
this_week_add_sm: "本週新增:<br/>{0}个",
this_week_execute_sm: "本週執行:<br/>{0}次",
executed_sm: "歷史總執行:<br/>{0}次",
},
test_scene_details_card:{
test_scene_details_card: {
title: "場景",
this_week_add:"本週新增: {0}个",
this_week_execute:"本週執行: {0}次",
executed:"歷史總執行: {0}次",
this_week_add_sm:"本週新增:<br/>{0}个",
this_week_execute_sm:"本週執行:<br/>{0}次",
executed_sm:"歷史總執行:<br/>{0}次",
this_week_add: "本週新增: {0}个",
this_week_execute: "本週執行: {0}次",
executed: "歷史總執行: {0}次",
this_week_add_sm: "本週新增:<br/>{0}个",
this_week_execute_sm: "本週執行:<br/>{0}次",
executed_sm: "歷史總執行:<br/>{0}次",
},
schedule_task_details_card:{
schedule_task_details_card: {
title: "定時任務",
this_week_add:"本週新增: {0}个",
this_week_execute:"本週執行: {0}次",
executed:"歷史總執行: {0}次",
this_week_add_sm:"本週新增:<br/>{0}个",
this_week_execute_sm:"本週執行:<br/>{0}次",
executed_sm:"歷史總執行:<br/>{0}次",
this_week_add: "本週新增: {0}个",
this_week_execute: "本週執行: {0}次",
executed: "歷史總執行: {0}次",
this_week_add_sm: "本週新增:<br/>{0}个",
this_week_execute_sm: "本週執行:<br/>{0}次",
executed_sm: "歷史總執行:<br/>{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: "要關閉這條定時任務嗎?",
}
}