feat(接口测试): 报告增加脚本执行失败标识

This commit is contained in:
fit2-zhao 2024-03-14 18:11:01 +08:00 committed by Craftsman
parent 9488fa681d
commit 717e3ae396
5 changed files with 40 additions and 3 deletions

View File

@ -29,6 +29,9 @@ public class ProcessResultDTO {
// 请求总时长
private long requestDuration;
// 标记执行步骤中是否有脚本报错记录最后一次错误信息
private String lastScriptIdentifier;
public void computerTotal() {
this.total = this.pendingCount + this.errorCount + this.successCount;
}

View File

@ -62,7 +62,7 @@
</a-trigger>
</template>
<!-- 报告结果筛选 -->
<template #statusFilter="{ columnConfig }">
<template #statusFilter="{ record, columnConfig }">
<a-trigger
v-model:popup-visible="statusFilterVisible"
trigger="click"
@ -79,7 +79,11 @@
<div class="flex items-center justify-center px-[6px] py-[2px]">
<a-checkbox-group v-model:model-value="statusListFilters" direction="vertical" size="small">
<a-checkbox v-for="key of statusFilters" :key="key" :value="key">
<ExecutionStatus :module-type="props.moduleType" :status="key" />
<ExecutionStatus
:module-type="props.moduleType"
:status="key"
:script-identifier="record.scriptIdentifier"
/>
</a-checkbox>
</a-checkbox-group>
</div>
@ -192,7 +196,7 @@
slotName: 'status',
titleSlotName: 'statusFilter',
showInTable: true,
width: 150,
width: 200,
showDrag: true,
},
{

View File

@ -2,12 +2,26 @@
<div class="flex items-center justify-start">
<MsIcon :type="getExecutionResult().icon" :class="getExecutionResult()?.color" size="14" />
<span class="ml-1">{{ t(getExecutionResult().label) }}</span>
<a-tooltip v-if="props.scriptIdentifier" :content="getMsg()">
<MsTag
class="ml-2"
:self-style="{
border: `1px solid ${methodColor}`,
color: methodColor,
backgroundColor: 'white',
}"
>
{{ t('report.detail.script.error') }}
</MsTag>
</a-tooltip>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import MsTag from '@/components/pure/ms-tag/ms-tag.vue';
import { useI18n } from '@/hooks/useI18n';
import { ReportEnum } from '@/enums/reportEnum';
@ -15,6 +29,7 @@
const { t } = useI18n();
const props = defineProps<{
status: string;
scriptIdentifier?: string;
moduleType: keyof typeof ReportEnum;
}>();
@ -98,6 +113,14 @@
function getExecutionResult(): IconType {
return iconTypeStatus.value[props.moduleType][props.status];
}
const methodColor = 'rgb(var(--warning-7))';
function getMsg() {
if (props.moduleType === ReportEnum.API_SCENARIO_REPORT && props.scriptIdentifier) {
return t('report.detail.scenario.errorTip');
}
return t('report.detail.api.errorTip');
}
</script>
<style scoped></style>

View File

@ -28,4 +28,8 @@ export default {
'report.detail.fakeErrorCount': 'False alarm',
'report.detail.pendingCount': 'Not executed',
'report.detail.stepTotal': 'total',
'report.detail.script.error': 'Script error',
'report.detail.scenario.errorTip':
'There is a pre/post script running error in the execution step of the current scenario.',
'report.detail.api.errorTip': 'There are pre/post script running errors in the current use case execution.',
};

View File

@ -28,4 +28,7 @@ export default {
'report.detail.fakeErrorCount': '误报',
'report.detail.pendingCount': '未执行',
'report.detail.stepTotal': '总数',
'report.detail.script.error': '脚本失败',
'report.detail.scenario.errorTip': '当前场景的执行步骤中存在 前/后置脚本运行错误',
'report.detail.api.errorTip': '当前用例执行存在 前/后置脚本运行错误',
};