fix(测试跟踪): 修复测试跟踪报告导出的一些问题

--bug=1026212 --user=宋天阳 【测试跟踪】报告-导出-点击查看场景执行结果步骤-报错
https://www.tapd.cn/55049933/s/1372491;--bug=1026214 --user=宋天阳
【测试跟踪】报告-导出-事务控制器实际执行结果为Pending-导出后显示为Error
https://www.tapd.cn/55049933/s/1372492;--bug=1026216 --user=宋天阳
【测试跟踪】报告-导出-未执行数量统计错误
https://www.tapd.cn/55049933/s/1372493;--bug=1026221 --user=宋天阳
【测试跟踪】测试计划-执行-选择并行-点击保存并执行-再次点击执行按钮-仍显示之前的配置
https://www.tapd.cn/55049933/s/1372494;--bug=1026262 --user=宋天阳
【测试跟踪】执行测试计划后端报错 https://www.tapd.cn/55049933/s/1372497;
This commit is contained in:
song-tianyang 2023-05-17 15:59:06 +08:00 committed by fit2-zhao
parent 1ec400068d
commit d7a9828846
9 changed files with 31 additions and 26 deletions

View File

@ -54,8 +54,6 @@ public class TestPlanMessageService {
@Async
public void checkTestPlanStatusAndSendMessage(TestPlanReport report, TestPlanReportContentWithBLOBs testPlanReportContent, TestPlan testPlan, boolean sendMessage) {
if (report != null && testPlanReportContent != null) {
// 异步发送通知需要指定调用其他服务的user
HttpHeaderUtils.runAsUser(report.getCreator());
try {
report = testPlanReportService.checkTestPlanReportHasErrorCase(report, testPlanReportContent);
if (!report.getIsApiCaseExecuting() && !report.getIsPerformanceExecuting() && !report.getIsScenarioExecuting() && !report.getIsUiScenarioExecuting()) {
@ -70,8 +68,6 @@ public class TestPlanMessageService {
}
} catch (Exception e) {
LogUtil.error("检查测试计划状态出错", e);
} finally {
HttpHeaderUtils.clearUser();
}
}
@ -94,19 +90,16 @@ public class TestPlanMessageService {
} else {
subject = "任务通知";
}
String creator = testPlanReport.getCreator();
UserDTO userDTO = baseUserService.getUserDTO(creator);
HttpHeaderUtils.runAsUser(userDTO);
// 计算通过率
TestPlanDTOWithMetric testPlanDTOWithMetric = BeanUtils.copyBean(new TestPlanDTOWithMetric(), testPlan);
testPlanService.calcTestPlanRate(Collections.singletonList(testPlanDTOWithMetric));
String creator = testPlanReport.getCreator();
UserDTO userDTO = baseUserService.getUserDTO(creator);
// 计算各种属性
HttpHeaderUtils.runAsUser(userDTO);
TestPlanReportDataStruct report = testPlanReportService.getReport(testPlanReport.getId());
HttpHeaderUtils.clearUser();
Map<String, Long> caseCountMap = calculateCaseCount(report);
Map paramMap = new HashMap();
paramMap.put("type", "testPlan");
paramMap.put("url", url);

View File

@ -408,7 +408,6 @@ public class TestPlanService {
if (serviceIdSet.contains(MicroServiceName.UI_TEST)) {
calcExecResultStatus(testPlan.getId(), testPlan, planTestPlanUiScenarioCaseService::getExecResultByPlanId);
}
testPlan.setPassRate(MathUtils.getPercentWithDecimal(testPlan.getTested() == 0 ? 0 : testPlan.getPassed() * 1.0 / testPlan.getTotal()));
testPlan.setTestRate(MathUtils.getPercentWithDecimal(testPlan.getTotal() == 0 ? 0 : testPlan.getTested() * 1.0 / testPlan.getTotal()));
}

View File

@ -1138,6 +1138,7 @@ export default {
this.cardLoading = true;
testPlanRunSave(param).then(() => {
this.cardLoading = false;
this.initTableData();
this.$success(this.$t("commons.run_success"));
});
} else if (config.executionWay === "save") {

View File

@ -30,6 +30,7 @@
:report="report"
:is-share="isShare"
:share-id="shareId"
:is-template="isTemplate"
v-on:requestResult="requestResult"
ref="resultsTree"/>
</el-tab-pane>
@ -118,9 +119,9 @@ import MsApiReportViewHeader from "./ApiReportViewHeader";
import {RequestFactory} from "metersphere-frontend/src/model/ApiTestModel";
import {getCurrentProjectID} from "metersphere-frontend/src/utils/token";
import {getUUID, windowPrint} from "metersphere-frontend/src/utils";
import {hasLicense} from "metersphere-frontend/src/utils/permission";
import {STEP} from "metersphere-frontend/src/model/Setting";
import MsCodeEdit from "metersphere-frontend/src/components/MsCodeEdit";
export default {
name: "MsApiReport",
components: {

View File

@ -4,7 +4,10 @@
<el-col>
<span v-if="!debug">
<span>
<el-link v-if="isSingleScenario"
<span v-if="isTemplate">
{{ report.name }}
</span>
<el-link v-else-if="isSingleScenario"
type="primary"
class="report-name"
@click="redirect">

View File

@ -231,8 +231,8 @@
<div v-show="showUnExecuteReport && !isUi" class="metric-box">
<div class="value">
{{
content.scenarioStepUnExecuteReport
? content.scenarioStepUnExecuteReport
content.scenarioStepPending
? content.scenarioStepPending
: 0
}}
</div>
@ -445,6 +445,7 @@ export default {
return (
(this.content.scenarioStepUnExecuteReport &&
this.content.scenarioStepUnExecuteReport > 0) ||
(this.content.scenarioStepPending && this.content.scenarioStepPending > 0) ||
(this.content.scenarioUnExecute &&
this.content.scenarioUnExecute > 0) ||
(this.content.unExecute && this.content.unExecute > 0)

View File

@ -192,8 +192,9 @@
</el-col>
<el-col :span="2">
<div v-if="totalStatus">
<el-tag size="mini" v-if="totalStatus === 'unexecute'"
> Pending
<el-tag size="mini"
v-if="totalStatus === 'unexecute' || totalStatus === 'Pending'|| totalStatus === 'PENDING'"
> Pending
</el-tag>
<el-tag
v-else-if="
@ -294,6 +295,7 @@ export default {
console: String,
totalStatus: String,
redirect: Boolean,
isTemplate: Boolean,
errorCode: {
type: String,
default: "",
@ -388,12 +390,14 @@ export default {
this.request.responseResult.body === null ||
this.request.responseResult.body === undefined
) {
if (this.isShare) {
if (this.isTemplate) {
this.requestInfo.loading = false;
} else if (this.isShare) {
this.$get(
"/share/" +
this.shareId +
"/scenario/report/selectReportContent/" +
this.stepId
this.shareId +
"/scenario/report/selectReportContent/" +
this.stepId
).then((response) => {
this.requestInfo = response.data;
this.$nextTick(() => {

View File

@ -14,8 +14,8 @@
</el-col>
<el-col :span="8">
<div class="url">
{{ $t('api_report.start_time') }}{{ request.startTime | timestampFormatDate(true) }}
{{ $t('report.test_end_time') }}{{ request.endTime | timestampFormatDate(true) }}
{{ $t('api_report.start_time') }}{{ request.startTime | datetimeFormat }}
{{ $t('report.test_end_time') }}{{ request.endTime | datetimeFormat }}
</div>
</el-col>
</el-row>

View File

@ -4,7 +4,7 @@
|| (node.type && this.stepFilter.get('AllSamplerProxy').indexOf(node.type) === -1)">
<el-card class="ms-card">
<el-row>
<el-col span="23">
<el-col :span="22">
<div class="el-step__icon is-text ms-api-col">
<div class="el-step__icon-inner">
{{ node.index }}
@ -17,8 +17,10 @@
<span v-else>{{ getLabel(node.label) }}</span>
</el-tooltip>
</el-col>
<el-col :span="1">
<ms-api-report-status :status="node.totalStatus" v-if="node.label !=='ConstantTimer'"/>
<el-col :span="2">
<div style="float: right">
<ms-api-report-status :status="node.totalStatus" v-if="node.label !=='ConstantTimer'"/>
</div>
</el-col>
</el-row>
</el-card>
@ -45,6 +47,7 @@
:total-status="node.totalStatus"
:console="console"
:isActive="isActive"
:is-template="isTemplate"
:is-share="isShare"
:share-id="shareId"
v-on:requestResult="requestResult"