fix(接口测试): 修复接口测试首页已覆盖跳转数据不对的问题

--bug=1019760 --user=宋天阳 【接口测试】接口、用例、场景的接口覆盖率跳转不正确
https://www.tapd.cn/55049933/s/1299684
This commit is contained in:
song-tianyang 2022-11-21 16:05:06 +08:00 committed by 刘瑞斌
parent eae9608e9b
commit b8ff9deca8
4 changed files with 11 additions and 14 deletions

View File

@ -810,7 +810,7 @@
</if> </if>
</if> </if>
<if test="request.apiCoverage == 'coverage' "> <if test="request.apiCoverage == 'covered' ">
and and
( (
api_definition.id in (SELECT api_definition_id FROM api_test_case WHERE `status` is null or `status` != api_definition.id in (SELECT api_definition_id FROM api_test_case WHERE `status` is null or `status` !=
@ -829,7 +829,7 @@
and api_definition.id not in and api_definition.id not in
(SELECT api_definition_id FROM api_test_case WHERE `status` is null or `status` != 'Trash') (SELECT api_definition_id FROM api_test_case WHERE `status` is null or `status` != 'Trash')
</if> </if>
<if test="request.apiCaseCoverage == 'coverage' "> <if test="request.apiCaseCoverage == 'covered' ">
and api_definition.id in and api_definition.id in
(SELECT api_definition_id FROM api_test_case WHERE `status` is null or `status` != 'Trash') (SELECT api_definition_id FROM api_test_case WHERE `status` is null or `status` != 'Trash')
</if> </if>
@ -842,7 +842,7 @@
</if> </if>
</if> </if>
<if test="request.scenarioCoverage == 'coverage' "> <if test="request.scenarioCoverage == 'covered' ">
<if test=" request.coverageIds != null and request.coverageIds.size() > 0"> <if test=" request.coverageIds != null and request.coverageIds.size() > 0">
and api_definition.id in and api_definition.id in
<foreach collection="request.coverageIds" item="nodeId" separator="," open="(" close=")"> <foreach collection="request.coverageIds" item="nodeId" separator="," open="(" close=")">
@ -926,7 +926,7 @@
</if> </if>
</if> </if>
<if test="request.apiCoverage == 'coverage' "> <if test="request.apiCoverage == 'covered' ">
and and
( (
api_definition.id in (SELECT api_definition_id FROM api_test_case WHERE `status` is null or `status` != api_definition.id in (SELECT api_definition_id FROM api_test_case WHERE `status` is null or `status` !=
@ -945,7 +945,7 @@
and api_definition.id not in and api_definition.id not in
(SELECT api_definition_id FROM api_test_case WHERE `status` is null or `status` != 'Trash') (SELECT api_definition_id FROM api_test_case WHERE `status` is null or `status` != 'Trash')
</if> </if>
<if test="request.apiCaseCoverage == 'coverage' "> <if test="request.apiCaseCoverage == 'covered' ">
and api_definition.id in and api_definition.id in
(SELECT api_definition_id FROM api_test_case WHERE `status` is null or `status` != 'Trash') (SELECT api_definition_id FROM api_test_case WHERE `status` is null or `status` != 'Trash')
</if> </if>
@ -958,7 +958,7 @@
</if> </if>
</if> </if>
<if test="request.scenarioCoverage == 'coverage' "> <if test="request.scenarioCoverage == 'covered' ">
<if test=" request.coverageIds != null and request.coverageIds.size() > 0"> <if test=" request.coverageIds != null and request.coverageIds.size() > 0">
and api_definition.id in and api_definition.id in
<foreach collection="request.coverageIds" item="nodeId" separator="," open="(" close=")"> <foreach collection="request.coverageIds" item="nodeId" separator="," open="(" close=")">

View File

@ -399,8 +399,7 @@ public class ApiDefinitionService {
if (StringUtils.equalsAnyIgnoreCase(request.getApiCoverage(), ApiHomeFilterEnum.NOT_COVERED, ApiHomeFilterEnum.COVERED)) { if (StringUtils.equalsAnyIgnoreCase(request.getApiCoverage(), ApiHomeFilterEnum.NOT_COVERED, ApiHomeFilterEnum.COVERED)) {
//计算没有用例接口的覆盖数量 //计算没有用例接口的覆盖数量
definitionList = this.selectEffectiveIdByProjectIdAndHaveNotCase(request.getProjectId()); definitionList = this.selectEffectiveIdByProjectIdAndHaveNotCase(request.getProjectId());
} } else if (StringUtils.equalsAnyIgnoreCase(request.getScenarioCoverage(), ApiHomeFilterEnum.NOT_COVERED, ApiHomeFilterEnum.COVERED)) {
if (StringUtils.equalsAnyIgnoreCase(request.getScenarioCoverage(), ApiHomeFilterEnum.NOT_COVERED, ApiHomeFilterEnum.COVERED)) {
//计算全部用例 //计算全部用例
definitionList = this.selectEffectiveIdByProjectId(request.getProjectId()); definitionList = this.selectEffectiveIdByProjectId(request.getProjectId());
} }

View File

@ -670,17 +670,16 @@ export default {
this.condition.selectThisWeedData = false; this.condition.selectThisWeedData = false;
this.condition.apiCaseCoverage = null; this.condition.apiCaseCoverage = null;
this.condition.apiCoverage = null; this.condition.apiCoverage = null;
this.condition.scenarioCoverage = null;
switch (this.selectDataRange) { switch (this.selectDataRange) {
case 'thisWeekCount': case 'thisWeekCount':
this.condition.selectThisWeedData = true; this.condition.selectThisWeedData = true;
break; break;
case 'notCovered': case 'notCovered':
this.condition.apiCoverage = 'unCovered'; this.condition.apiCoverage = 'unCovered';
this.condition.scenarioCoverage = null;
break; break;
case 'covered': case 'covered':
this.condition.apiCoverage = '"covered"'; this.condition.apiCoverage = 'covered';
this.condition.scenarioCoverage = 'covered';
break; break;
case 'notCoveredTestCase': case 'notCoveredTestCase':
this.condition.apiCaseCoverage = 'unCovered'; this.condition.apiCaseCoverage = 'unCovered';
@ -690,11 +689,9 @@ export default {
break; break;
case 'coveredScenario': case 'coveredScenario':
this.condition.scenarioCoverage = 'covered'; this.condition.scenarioCoverage = 'covered';
this.condition.apiCoverage = null;
break; break;
case 'notCoveredScenario': case 'notCoveredScenario':
this.condition.scenarioCoverage = 'unCovered'; this.condition.scenarioCoverage = 'unCovered';
this.condition.apiCoverage = null;
break; break;
case 'Prepare': case 'Prepare':
this.condition.filters.status = [this.selectDataRange]; this.condition.filters.status = [this.selectDataRange];

View File

@ -191,7 +191,7 @@ export default {
} }
.api-home-layout :deep(.home-table-cell) { .api-home-layout :deep(.home-table-cell) {
height: 38px; height: 40px;
background-color: #f5f6f7; background-color: #f5f6f7;
font-size: 14px; font-size: 14px;
font-weight: 500; font-weight: 500;
@ -215,6 +215,7 @@ export default {
.api-home-layout :deep(.el-table__row), .api-home-layout :deep(.el-table__row),
.adjust-table :deep(.el-table__row .el-link) { .adjust-table :deep(.el-table__row .el-link) {
height: 40px;
font-size: 14px; font-size: 14px;
font-weight: 400; font-weight: 400;
line-height: 22px; line-height: 22px;