style(测试跟踪): 修复测试跟踪中测试计划报告部分用例不显示报告的问题

--bug=1015004 --user=宋天阳 【接口测试】场景,列表执行或者调试生成报告,没有展示环境信息
https://www.tapd.cn/55049933/s/1210993
This commit is contained in:
song-tianyang 2022-07-25 18:50:47 +08:00 committed by 建国
parent d2365b00b9
commit 95b66ed75a
6 changed files with 51 additions and 15 deletions

View File

@ -69,6 +69,7 @@ public class ApiDefinitionController {
request.setToBeUpdateTime(toBeUpdatedTime);
}
}
apiDefinitionService.checkFilterHasCoverage(request);
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, apiDefinitionService.list(request));
}

View File

@ -326,6 +326,16 @@ public class ApiDefinitionService {
}
}
}
return request;
}
/**
* 检查请求中是否含有覆盖率的查询
*
* @param request
* @return
*/
public ApiDefinitionRequest checkFilterHasCoverage(ApiDefinitionRequest request) {
if (StringUtils.isNotEmpty(request.getProjectId())) {
List<ApiDefinition> definitionList = null;
if (StringUtils.equalsAnyIgnoreCase(request.getApiCoverage(), "uncoverage", "coverage")) {

View File

@ -10,7 +10,7 @@
!= 'Trash'
AND project_id = #{0}
AND latest = 1)
AND reference_id IS NOT NULL;
AND reference_id IS NOT NULL
</select>
</mapper>

View File

@ -36,9 +36,9 @@ import io.metersphere.performance.service.MetricQueryService;
import io.metersphere.performance.service.PerformanceReportService;
import io.metersphere.performance.service.PerformanceTestService;
import io.metersphere.service.*;
import io.metersphere.track.factory.ReportComponentFactory;
import io.metersphere.track.domain.ReportComponent;
import io.metersphere.track.dto.*;
import io.metersphere.track.factory.ReportComponentFactory;
import io.metersphere.track.request.testcase.PlanCaseRelevanceRequest;
import io.metersphere.track.request.testcase.QueryTestPlanRequest;
import io.metersphere.track.request.testplan.AddTestPlanRequest;
@ -1441,7 +1441,17 @@ public class TestPlanService {
ApiDefinitionExecResultWithBLOBs result = extApiDefinitionExecResultMapper.selectPlanApiMaxResultByTestIdAndType(apiCase.getId(), "API_PLAN");
if (result != null && StringUtils.isNotBlank(result.getContent())) {
apiCase.setReportId(result.getId());
apiCase.setResponse(result.getContent());
String contentStr = result.getContent();
try {
JSONObject content = JSONObject.parseObject(contentStr);
if (StringUtils.isNotEmpty(contentStr)) {
content.put("envName", apiDefinitionService.getEnvNameByEnvConfig(result.getProjectId(), result.getEnvConfig()));
}
contentStr = content.toString();
apiCase.setResponse(contentStr);
} catch (Exception e) {
LogUtil.error("解析content失败!", e);
}
}
} else {
reportIds.add(apiCase.getReportId());
@ -1461,7 +1471,7 @@ public class TestPlanService {
if (StringUtils.isNotEmpty(execResult.getEnvConfig())) {
responseObj.put("envName", apiDefinitionService.getEnvNameByEnvConfig(execResult.getProjectId(), execResult.getEnvConfig()));
}
item.setResponse(resultMap.get(item.getReportId()).getContent());
item.setResponse(responseObj.toString());
}
});
}

View File

@ -63,30 +63,45 @@
</el-row>
</el-col>
<el-col :span="8">
<span class="ms-report-time-desc">
<div v-if="isPlanReport" style="float: right;margin-right: 10px;">
<div v-if="showProjectEnv" type="flex">
<span> {{ $t('commons.environment') + ':' }} </span>
<div v-for="(values,key) in projectEnvMap" :key="key" style="margin-right: 10px">
{{ key + ":" }}
<ms-tag v-for="(item,index) in values" :key="index" type="success" :content="item"
style="margin-left: 2px"/>
</div>
<div v-show="showMoreProjectEnvMap">
<el-link icon="el-icon-more" @click="showAllProjectInfo"></el-link>
</div>
</div>
</div>
<div style="float: left">
<span class="ms-report-time-desc">
{{
$t('report.test_duration', [templateMinutes ? templateMinutes : minutes,
templateSeconds ? templateSeconds : seconds])
}}
$t('report.test_duration', [templateMinutes ? templateMinutes : minutes,
templateSeconds ? templateSeconds : seconds])
}}
</span>
<span class="ms-report-time-desc" v-if="startTime !== '0'">
<span class="ms-report-time-desc" v-if="startTime !== '0'">
{{ $t('report.test_start_time') }}{{ startTime | timestampFormatDate }}
</span>
<span class="ms-report-time-desc" v-else-if="planReportTemplate && planReportTemplate.startTime">
<span class="ms-report-time-desc" v-else-if="planReportTemplate && planReportTemplate.startTime">
{{ $t('report.test_start_time') }}{{ planReportTemplate.startTime | timestampFormatDate }}
</span>
<span class="ms-report-time-desc" v-else>
<span class="ms-report-time-desc" v-else>
{{ $t('report.test_start_time') }}-
</span>
<span class="ms-report-time-desc" v-if="report.status === 'Completed' && endTime !== '0'">
<span class="ms-report-time-desc" v-if="report.status === 'Completed' && endTime !== '0'">
{{ $t('report.test_end_time') }}{{ endTime | timestampFormatDate }}
</span>
<span class="ms-report-time-desc" v-else-if="planReportTemplate && planReportTemplate.endTime">
<span class="ms-report-time-desc" v-else-if="planReportTemplate && planReportTemplate.endTime">
{{ $t('report.test_end_time') }}{{ planReportTemplate.endTime | timestampFormatDate }}
</span>
<span class="ms-report-time-desc" v-else>
<span class="ms-report-time-desc" v-else>
{{ $t('report.test_end_time') }}-
</span>
</div>
</el-col>
</el-row>

View File

@ -31,7 +31,6 @@
import TestPlanFunctionalReport
from "@/business/components/track/plan/view/comonents/report/detail/TestPlanFunctionalReport";
import {
getExportReport,
getShareTestPlanReport,
getShareTestPlanReportContent,
getTestPlanReport,
@ -50,6 +49,7 @@ import TestPlanReportNavigationBar
from "@/business/components/track/plan/view/comonents/report/detail/TestPlanReportNavigationBar";
import MsContainer from "@/business/components/common/components/MsContainer";
import MsMainContainer from "@/business/components/common/components/MsMainContainer";
export default {
name: "TestPlanReportContent",
components: {