fix(接口测试): 修复接口测试首页统计数量错误的问题
--bug=1019799 --user=宋天阳 【接口测试】首页-场景用例数量统计,开启url可重复后,复制和引用case,场景的接口覆盖率没增加 https://www.tapd.cn/55049933/s/1298583
This commit is contained in:
parent
913434e11c
commit
3cfc0e5547
|
@ -368,10 +368,7 @@
|
||||||
SELECT count(id) AS countNumber
|
SELECT count(id) AS countNumber
|
||||||
FROM scenario_execution_info
|
FROM scenario_execution_info
|
||||||
WHERE trigger_mode = 'SCHEDULE'
|
WHERE trigger_mode = 'SCHEDULE'
|
||||||
AND source_id IN (SELECT id
|
AND project_id = #{projectId}
|
||||||
FROM api_scenario
|
|
||||||
WHERE project_id = #{projectId}
|
|
||||||
AND latest = 1)
|
|
||||||
<if test="version != null">
|
<if test="version != null">
|
||||||
AND version = #{version}
|
AND version = #{version}
|
||||||
</if>
|
</if>
|
||||||
|
@ -382,10 +379,7 @@
|
||||||
SELECT count(id) AS countNumber, result AS groupField
|
SELECT count(id) AS countNumber, result AS groupField
|
||||||
FROM scenario_execution_info
|
FROM scenario_execution_info
|
||||||
WHERE trigger_mode = 'SCHEDULE'
|
WHERE trigger_mode = 'SCHEDULE'
|
||||||
AND source_id IN (SELECT id
|
AND project_id = #{projectId}
|
||||||
FROM api_scenario
|
|
||||||
WHERE project_id = #{projectId}
|
|
||||||
AND latest = 1)
|
|
||||||
<if test="version != null">
|
<if test="version != null">
|
||||||
AND version = #{version}
|
AND version = #{version}
|
||||||
</if>
|
</if>
|
||||||
|
|
|
@ -303,13 +303,12 @@ public class ApiDefinitionExecResultService {
|
||||||
if (StringUtils.equalsAny(dto.getRunMode(), ApiRunMode.SCHEDULE_API_PLAN.name(), ApiRunMode.JENKINS_API_PLAN.name())) {
|
if (StringUtils.equalsAny(dto.getRunMode(), ApiRunMode.SCHEDULE_API_PLAN.name(), ApiRunMode.JENKINS_API_PLAN.name())) {
|
||||||
TestPlanApiCase apiCase = testPlanApiCaseMapper.selectByPrimaryKey(dto.getTestId());
|
TestPlanApiCase apiCase = testPlanApiCaseMapper.selectByPrimaryKey(dto.getTestId());
|
||||||
if (apiCase != null) {
|
if (apiCase != null) {
|
||||||
TestPlan testPlan = testPlanService.get(apiCase.getTestPlanId());
|
if (MapUtils.isNotEmpty(dto.getExtendedParameters()) && dto.getExtendedParameters().containsKey("projectId")) {
|
||||||
if (testPlan != null) {
|
String projectId = dto.getExtendedParameters().get("projectId").toString();
|
||||||
ApiDefinition apiDefinition = extApiTestCaseMapper.selectApiBasicInfoByCaseId(apiCase.getId());
|
ApiDefinition apiDefinition = extApiTestCaseMapper.selectApiBasicInfoByCaseId(apiCase.getId());
|
||||||
String version = apiDefinition == null ? "" : apiDefinition.getVersionId();
|
String version = apiDefinition == null ? "" : apiDefinition.getVersionId();
|
||||||
apiCaseExecutionInfoService.insertExecutionInfo(apiCase.getId(), status, triggerMode, testPlan.getProjectId(), ExecutionExecuteTypeEnum.TEST_PLAN.name(), version);
|
apiCaseExecutionInfoService.insertExecutionInfo(apiCase.getId(), status, triggerMode, projectId, ExecutionExecuteTypeEnum.TEST_PLAN.name(), version);
|
||||||
}
|
}
|
||||||
|
|
||||||
apiCase.setStatus(status);
|
apiCase.setStatus(status);
|
||||||
apiCase.setUpdateTime(System.currentTimeMillis());
|
apiCase.setUpdateTime(System.currentTimeMillis());
|
||||||
testPlanApiCaseMapper.updateByPrimaryKeySelective(apiCase);
|
testPlanApiCaseMapper.updateByPrimaryKeySelective(apiCase);
|
||||||
|
|
|
@ -1768,26 +1768,14 @@ public class ApiScenarioService {
|
||||||
public List<String> getApiIdInScenario(String projectId, Map<String, Map<String, String>> scenarioUrlMap, List<ApiDefinition> apiList) {
|
public List<String> getApiIdInScenario(String projectId, Map<String, Map<String, String>> scenarioUrlMap, List<ApiDefinition> apiList) {
|
||||||
List<String> apiIdList = new ArrayList<>();
|
List<String> apiIdList = new ArrayList<>();
|
||||||
if (MapUtils.isNotEmpty(scenarioUrlMap) && CollectionUtils.isNotEmpty(apiList)) {
|
if (MapUtils.isNotEmpty(scenarioUrlMap) && CollectionUtils.isNotEmpty(apiList)) {
|
||||||
ProjectApplication urlRepeatableConfig = baseProjectApplicationService.getProjectApplication(projectId, ProjectApplicationType.URL_REPEATABLE.name());
|
|
||||||
boolean isUrlRepeatable = BooleanUtils.toBoolean(urlRepeatableConfig.getTypeValue());
|
|
||||||
for (ApiDefinition model : apiList) {
|
for (ApiDefinition model : apiList) {
|
||||||
if (StringUtils.equalsIgnoreCase(model.getProtocol(), "http")) {
|
if (StringUtils.equalsIgnoreCase(model.getProtocol(), "http")) {
|
||||||
Map<String, String> stepIdAndUrlMap = scenarioUrlMap.get(model.getMethod());
|
Map<String, String> stepIdAndUrlMap = scenarioUrlMap.get(model.getMethod());
|
||||||
if (stepIdAndUrlMap != null) {
|
if (stepIdAndUrlMap != null) {
|
||||||
if (isUrlRepeatable) {
|
Collection<String> scenarioUrlList = scenarioUrlMap.get(model.getMethod()).values();
|
||||||
String url = stepIdAndUrlMap.get(model.getId());
|
boolean matchedUrl = MockApiUtils.isUrlInList(model.getPath(), scenarioUrlList);
|
||||||
if (StringUtils.isNotEmpty(url)) {
|
if (matchedUrl) {
|
||||||
boolean urlMatched = MockApiUtils.isUrlMatch(model.getPath(), url);
|
apiIdList.add(model.getId());
|
||||||
if (urlMatched) {
|
|
||||||
apiIdList.add(model.getId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Collection<String> scenarioUrlList = scenarioUrlMap.get(model.getMethod()).values();
|
|
||||||
boolean matchedUrl = MockApiUtils.isUrlInList(model.getPath(), scenarioUrlList);
|
|
||||||
if (matchedUrl) {
|
|
||||||
apiIdList.add(model.getId());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -2194,7 +2182,7 @@ public class ApiScenarioService {
|
||||||
if (returnMap.containsKey(method)) {
|
if (returnMap.containsKey(method)) {
|
||||||
returnMap.get(method).put(item.getReferenceId(), item.getUrl());
|
returnMap.get(method).put(item.getReferenceId(), item.getUrl());
|
||||||
} else {
|
} else {
|
||||||
Map<String, String> urlMap = new HashMap() {{
|
Map<String, String> urlMap = new HashMap<>() {{
|
||||||
this.put(item.getReferenceId(), item.getUrl());
|
this.put(item.getReferenceId(), item.getUrl());
|
||||||
}};
|
}};
|
||||||
returnMap.put(method, urlMap);
|
returnMap.put(method, urlMap);
|
||||||
|
|
|
@ -139,15 +139,15 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
.api-home-layout :deep(.dashboard-card) {
|
.api-home-layout :deep(.dashboard-card) {
|
||||||
height: 392px;
|
height: 408px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.api-home-layout :deep(.main-info) {
|
.api-home-layout :deep(.main-info) {
|
||||||
height: 197px;
|
height: 208px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.api-home-layout :deep(.main-info-card) {
|
.api-home-layout :deep(.main-info-card) {
|
||||||
height: 197px;
|
height: 208px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
color: #646A73;
|
color: #646A73;
|
||||||
background-color: #FFFFFF;
|
background-color: #FFFFFF;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<template>
|
<template>
|
||||||
<div v-if="reloadOver">
|
<div v-if="reloadOver">
|
||||||
<el-row type="flex" justify="left" align="left">
|
<el-row type="flex" justify="left" align="left">
|
||||||
<div style="height: 184px;width: 100%;margin-left: 30px;margin-right: 30px;">
|
<div style="height: 208px;width: 100%;margin-left: 26px;margin-right: 30px;">
|
||||||
<ms-chart :options="options"
|
<ms-chart :options="options"
|
||||||
:height="184"
|
:height="208"
|
||||||
width="100%"
|
width="100%"
|
||||||
:autoresize="true"/>
|
:autoresize="true"/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -114,7 +114,7 @@ export default {
|
||||||
icon: "rect",
|
icon: "rect",
|
||||||
selectedMode: dataIsNotEmpty,
|
selectedMode: dataIsNotEmpty,
|
||||||
itemGap: 16,
|
itemGap: 16,
|
||||||
left: '45%',
|
left: '50%',
|
||||||
y: 'center',
|
y: 'center',
|
||||||
itemHeight: 8,
|
itemHeight: 8,
|
||||||
itemWidth: 8, //修改icon图形大小
|
itemWidth: 8, //修改icon图形大小
|
||||||
|
@ -156,7 +156,7 @@ export default {
|
||||||
text: "{mainTitle|" + this.$t("home.dashboard.api.api_total") + "}\n\n{number|" + this.getAmount() + "}\n\n",
|
text: "{mainTitle|" + this.$t("home.dashboard.api.api_total") + "}\n\n{number|" + this.getAmount() + "}\n\n",
|
||||||
subtext: this.$t("home.dashboard.public.this_week") + ":+" + formatNumber(this.apiData.createdInWeek) + " >",
|
subtext: this.$t("home.dashboard.public.this_week") + ":+" + formatNumber(this.apiData.createdInWeek) + " >",
|
||||||
top: "center",
|
top: "center",
|
||||||
left: "86px",
|
left: "100px",
|
||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
textStyle: {
|
textStyle: {
|
||||||
rich: {
|
rich: {
|
||||||
|
@ -187,8 +187,8 @@ export default {
|
||||||
series: [
|
series: [
|
||||||
{
|
{
|
||||||
type: 'pie',
|
type: 'pie',
|
||||||
radius: ['70%', '96%'],
|
radius: [75, 100],
|
||||||
center: ['92px', '50%'],
|
center: ['104px', '50%'],
|
||||||
avoidLabelOverlap: false,
|
avoidLabelOverlap: false,
|
||||||
hoverAnimation: dataIsNotEmpty,
|
hoverAnimation: dataIsNotEmpty,
|
||||||
legendHoverLink: false,
|
legendHoverLink: false,
|
||||||
|
|
Loading…
Reference in New Issue