feat(测试跟踪): 测试跟踪-报告 列表表头增加运行耗时和成功率字段显示

--story=1004747 --user=周骏弘 【国信证券】测试跟踪-报告表头增加运行耗时列和成功率 https://www.tapd.cn/55049933/s/1089868
This commit is contained in:
junhong 2022-01-11 16:03:01 +08:00 committed by john1298308460
parent 9f18193c95
commit 44b34b239f
7 changed files with 158 additions and 49 deletions

View File

@ -91,10 +91,12 @@
parameterType="io.metersphere.track.request.report.QueryTestPlanReportRequest">
SELECT tpr.id AS id, tpr.`name` AS `name`, tp.`name` AS testPlanName,
IF(u.name is null,tpr.creator,u.name)AS creator, tpr.is_new, tpr.test_plan_id,
tpr.create_time AS createTime,tpr.trigger_mode AS triggerMode,tpr.status AS status
tpr.create_time AS createTime,tpr.trigger_mode AS triggerMode,tpr.status AS status,
tpr.end_time AS endTime, (tpr.end_time - tpr.create_time) AS runTime, tprc.pass_rate AS passRate
FROM test_plan tp
INNER JOIN test_plan_report tpr on tp.id = tpr.test_plan_id
LEFT JOIN user u on tpr.creator = u.id
LEFT JOIN test_plan_report_content tprc on tpr.id = tprc.test_plan_report_id
<where>
<if test="combine != null">
<include refid="combine">
@ -123,7 +125,17 @@
tp.name ${order.type}
</if>
<if test="order.name != 'test_plan_name'">
tpr.${order.name} ${order.type}
<if test="order.name == 'run_time'">
runTime ${order.type}
</if>
<if test="order.name == 'pass_rate'">
passRate ${order.type}
</if>
<if test="order.name != 'run_time' and order.name != 'pass_rate'">
tpr.${order.name} ${order.type}
</if>
</if>
</foreach>
</if>

View File

@ -35,4 +35,7 @@ public class TestPlanReportDTO {
private Long startTime;
private Long endTime;
private String projectName;
private Long runTime;
private Double passRate;
}

View File

@ -4,49 +4,78 @@
<ms-table-header :condition.sync="condition" :show-create="false"
@search="initTableData"/>
</template>
<el-table border :data="tableData"
@select-all="handleSelectAll"
@select="handleSelect"
:height="screenHeight"
ref="testPlanReportTable"
row-key="id"
class="test-content adjust-table ms-select-all-fixed"
@filter-change="filter" @sort-change="sort">
<el-table-column width="50" type="selection"/>
<ms-table
v-loading="result.loading"
operator-width="170px"
row-key="id"
:data="tableData"
:condition="condition"
:total="total"
:page-size.sync="pageSize"
:operators="operators"
:screen-height="screenHeight"
:batch-operators="batchButtons"
:remember-order="true"
:fields.sync="fields"
:field-key="tableHeaderKey"
@handlePageChange="initTableData"
@refresh="initTableData"
ref="testPlanReportTable">
<ms-table-header-select-popover v-show="total>0"
:page-size="pageSize > total ? total : pageSize"
:total="total"
:select-data-counts="selectDataCounts"
:table-data-count-in-page="tableData.length"
@selectPageAll="isSelectDataAll(false)"
@selectAll="isSelectDataAll(true)"/>
<span v-for="item in fields" :key="item.key">
<el-table-column width="30" :resizable="false" align="center">
<template v-slot:default="scope">
<show-more-btn :is-show="scope.row.showMore" :buttons="buttons" :size="selectDataCounts"/>
</template>
</el-table-column>
<ms-table-column
prop="name"
:field="item"
:fields-width="fieldsWidth"
sortable
:label="$t('test_track.report.list.name')"
min-width="200px">
</ms-table-column>
<el-table-column min-width="300" prop="name" :label="$t('test_track.report.list.name')"
show-overflow-tooltip></el-table-column>
<el-table-column prop="testPlanName" min-width="150" sortable :label="$t('test_track.report.list.test_plan')"
show-overflow-tooltip></el-table-column>
<el-table-column prop="creator" :label="$t('test_track.report.list.creator')"
show-overflow-tooltip></el-table-column>
<el-table-column prop="createTime" sortable :label="$t('test_track.report.list.create_time' )"
show-overflow-tooltip>
<ms-table-column
prop="testPlanName"
:field="item"
:fields-width="fieldsWidth"
:label="$t('test_track.report.list.test_plan')"
min-width="100"/>
<ms-table-column
prop="creator"
:field="item"
:fields-width="fieldsWidth"
:label="$t('test_track.report.list.creator')"/>
<ms-table-column
prop="createTime"
:field="item"
:fields-width="fieldsWidth"
sortable
:label="$t('test_track.report.list.create_time')"
min-width="150px">
<template v-slot:default="scope">
<span>{{ scope.row.createTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column prop="triggerMode" :label="$t('test_track.report.list.trigger_mode')" show-overflow-tooltip>
</ms-table-column>
<ms-table-column
prop="triggerMode"
:field="item"
:fields-width="fieldsWidth"
sortable
:label="$t('test_track.report.list.trigger_mode')">
<template v-slot:default="scope">
<report-trigger-mode-item :trigger-mode="scope.row.triggerMode"/>
</template>
</el-table-column>
<el-table-column prop="status" :label="$t('commons.status')">
</ms-table-column>
<ms-table-column
prop="status"
:field="item"
:fields-width="fieldsWidth"
sortable
:label="$t('commons.status')">
<template v-slot:default="scope">
<ms-tag v-if="scope.row.status == 'RUNNING'" type="success" effect="plain" :content="'Running'"/>
<ms-tag
@ -54,19 +83,34 @@
type="info" effect="plain" :content="'Completed'"/>
<ms-tag v-else type="effect" effect="plain" :content="scope.row.status"/>
</template>
</el-table-column>
<el-table-column min-width="150" :label="$t('commons.operating')">
</ms-table-column>
<ms-table-column
prop="runTime"
:field="item"
:fields-width="fieldsWidth"
sortable="custom"
:label="$t('test_track.report.list.run_time')">
<template v-slot:default="scope">
<div>
<ms-table-operator-button :tip="$t('test_track.plan_view.view_report')" icon="el-icon-document"
@exec="openReport(scope.row)"/>
<ms-table-operator-button v-permission="['PROJECT_TRACK_REPORT:READ+DELETE']" type="danger"
:tip="$t('commons.delete')" icon="el-icon-delete"
@exec="handleDelete(scope.row)"/>
</div>
<span v-if="scope.row.endTime != null">{{ (scope.row.runTime / 1000).toFixed(2) }}</span>
<span v-else>/</span>
</template>
</el-table-column>
</el-table>
</ms-table-column>
<ms-table-column
prop="passRate"
:field="item"
:fields-width="fieldsWidth"
sortable="custom"
:label="$t('test_track.report.list.pass_rate')">
<template v-slot:default="scope">
<span>{{ (scope.row.passRate ? (scope.row.passRate * 100 ).toFixed(1) : 0) + '%'}}</span>
</template>
</ms-table-column>
</span>
</ms-table>
<ms-table-pagination :change="initTableData" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/>
<test-plan-report-view @refresh="initTableData" ref="testPlanReportView"/>
@ -95,11 +139,15 @@ import {
initCondition,
saveLastTableSortField,
setUnSelectIds,
toggleAllSelection
toggleAllSelection,
getCustomTableWidth,
getCustomTableHeader
} from "@/common/js/tableUtils";
import MsTableHeaderSelectPopover from "@/business/components/common/components/table/MsTableHeaderSelectPopover";
import {getCurrentProjectID} from "@/common/js/utils";
import TestPlanDbReport from "@/business/components/track/report/components/TestPlanDbReport";
import MsTable from "@/business/components/common/components/table/MsTable";
import MsTableColumn from "@/business/components/common/components/table/MsTableColumn";
export default {
name: "TestPlanReportList",
@ -110,6 +158,8 @@ export default {
MsTableOperator, MsTableOperatorButton, MsTableHeader, MsTablePagination,
ReportTriggerModeItem, MsTag,
ShowMoreBtn, MsTableSelectAll,
MsTableColumn,
MsTable,
},
data() {
return {
@ -118,7 +168,7 @@ export default {
tableHeaderKey: "TRACK_REPORT_TABLE",
queryPath: "/test/plan/report/list",
condition: {
components: TEST_PLAN_REPORT_CONFIGS
components: TEST_PLAN_REPORT_CONFIGS,
},
currentPage: 1,
pageSize: 10,
@ -145,6 +195,29 @@ export default {
},
],
selectDataCounts: 0,
fields: getCustomTableHeader('TRACK_REPORT_TABLE'),
fieldsWidth: getCustomTableWidth('TRACK_REPORT_TABLE'),
operators: [],
batchButtons: [],
publicButtons: [
{
name: this.$t('api_test.definition.request.batch_delete'),
handleClick: this.handleDeleteBatch,
permission: ['PROJECT_TRACK_REPORT:READ+DELETE'],
},
],
simpleOperators: [
{
tip: this.$t('test_track.plan_view.view_report'), icon: "el-icon-document",
exec: this.openReport,
},
{
tip: this.$t('commons.delete'), icon: "el-icon-delete", type: "danger",
exec: this.handleDelete,
permissions: ['PROJECT_TRACK_REPORT:READ+DELETE']
},
],
};
},
watch: {
@ -156,6 +229,8 @@ export default {
},
created() {
this.projectId = this.$route.params.projectId;
this.batchButtons = this.publicButtons;
this.operators = this.simpleOperators;
if (!this.projectId) {
this.projectId = getCurrentProjectID();
}
@ -225,7 +300,7 @@ export default {
callback: (action) => {
if (action === 'confirm') {
let deleteParam = {};
let ids = Array.from(this.selectRows).map(row => row.id);
let ids = this.$refs.testPlanReportTable.selectIds;
deleteParam.dataIds = ids;
deleteParam.projectId = this.projectId;
deleteParam.selectAllDate = this.condition.selectAll;

View File

@ -198,6 +198,19 @@ export let CUSTOM_TABLE_HEADER = {
{id: 'desc', key: '9', label: 'test_track.case.case_desc'},
{id: 'lastExecResult', key: '0', label: 'test_track.plan_view.execute_result'},
],
// 测试报告
TRACK_REPORT_TABLE: [
{id: 'name', key: '1', label: 'test_track.report.list.name'},
{id: 'testPlanName', key: '2', label: 'test_track.report.list.test_plan'},
{id: 'creator', key: '3', label: 'test_track.report.list.creator'},
{id: 'createTime', key: '4', label: 'test_track.report.list.create_time'},
{id: 'triggerMode', key: '5', label: 'test_track.report.list.trigger_mode'},
{id: 'status', key: '6', label: 'commons.status'},
{id: 'runTime', key: '7', label: 'test_track.report.list.run_time'},
{id: 'passRate', key: '8', label: 'test_track.report.list.pass_rate'},
],
//缺陷列表
ISSUE_LIST: [
{id: 'num', key: '1', label: 'test_track.issue.id'},

View File

@ -2280,6 +2280,8 @@ export default {
creator: "Creator",
create_time: "Create Time",
trigger_mode: "Trigger Mode",
run_time: "run time(s)",
pass_rate: "pass rate",
status: "Status",
operation: "Operation",
},

View File

@ -2284,6 +2284,8 @@ export default {
creator: "创建人",
create_time: "创建时间",
trigger_mode: "触发方式",
run_time: "运行耗时(s)",
pass_rate: "成功率",
status: "状态",
operation: "操作",
},

View File

@ -2284,6 +2284,8 @@ export default {
creator: "創建人",
create_time: "創建時間",
trigger_mode: "觸發方式",
run_time: "運行耗時(s)",
pass_rate: "成功率",
status: "狀態",
operation: "操作",
},