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
|
||||
FROM scenario_execution_info
|
||||
WHERE trigger_mode = 'SCHEDULE'
|
||||
AND source_id IN (SELECT id
|
||||
FROM api_scenario
|
||||
WHERE project_id = #{projectId}
|
||||
AND latest = 1)
|
||||
AND project_id = #{projectId}
|
||||
<if test="version != null">
|
||||
AND version = #{version}
|
||||
</if>
|
||||
|
@ -382,10 +379,7 @@
|
|||
SELECT count(id) AS countNumber, result AS groupField
|
||||
FROM scenario_execution_info
|
||||
WHERE trigger_mode = 'SCHEDULE'
|
||||
AND source_id IN (SELECT id
|
||||
FROM api_scenario
|
||||
WHERE project_id = #{projectId}
|
||||
AND latest = 1)
|
||||
AND project_id = #{projectId}
|
||||
<if test="version != null">
|
||||
AND version = #{version}
|
||||
</if>
|
||||
|
|
|
@ -303,13 +303,12 @@ public class ApiDefinitionExecResultService {
|
|||
if (StringUtils.equalsAny(dto.getRunMode(), ApiRunMode.SCHEDULE_API_PLAN.name(), ApiRunMode.JENKINS_API_PLAN.name())) {
|
||||
TestPlanApiCase apiCase = testPlanApiCaseMapper.selectByPrimaryKey(dto.getTestId());
|
||||
if (apiCase != null) {
|
||||
TestPlan testPlan = testPlanService.get(apiCase.getTestPlanId());
|
||||
if (testPlan != null) {
|
||||
if (MapUtils.isNotEmpty(dto.getExtendedParameters()) && dto.getExtendedParameters().containsKey("projectId")) {
|
||||
String projectId = dto.getExtendedParameters().get("projectId").toString();
|
||||
ApiDefinition apiDefinition = extApiTestCaseMapper.selectApiBasicInfoByCaseId(apiCase.getId());
|
||||
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.setUpdateTime(System.currentTimeMillis());
|
||||
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) {
|
||||
List<String> apiIdList = new ArrayList<>();
|
||||
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) {
|
||||
if (StringUtils.equalsIgnoreCase(model.getProtocol(), "http")) {
|
||||
Map<String, String> stepIdAndUrlMap = scenarioUrlMap.get(model.getMethod());
|
||||
if (stepIdAndUrlMap != null) {
|
||||
if (isUrlRepeatable) {
|
||||
String url = stepIdAndUrlMap.get(model.getId());
|
||||
if (StringUtils.isNotEmpty(url)) {
|
||||
boolean urlMatched = MockApiUtils.isUrlMatch(model.getPath(), url);
|
||||
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());
|
||||
}
|
||||
Collection<String> scenarioUrlList = scenarioUrlMap.get(model.getMethod()).values();
|
||||
boolean matchedUrl = MockApiUtils.isUrlInList(model.getPath(), scenarioUrlList);
|
||||
if (matchedUrl) {
|
||||
apiIdList.add(model.getId());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -2194,7 +2182,7 @@ public class ApiScenarioService {
|
|||
if (returnMap.containsKey(method)) {
|
||||
returnMap.get(method).put(item.getReferenceId(), item.getUrl());
|
||||
} else {
|
||||
Map<String, String> urlMap = new HashMap() {{
|
||||
Map<String, String> urlMap = new HashMap<>() {{
|
||||
this.put(item.getReferenceId(), item.getUrl());
|
||||
}};
|
||||
returnMap.put(method, urlMap);
|
||||
|
|
|
@ -139,15 +139,15 @@ export default {
|
|||
}
|
||||
|
||||
.api-home-layout :deep(.dashboard-card) {
|
||||
height: 392px;
|
||||
height: 408px;
|
||||
}
|
||||
|
||||
.api-home-layout :deep(.main-info) {
|
||||
height: 197px;
|
||||
height: 208px;
|
||||
}
|
||||
|
||||
.api-home-layout :deep(.main-info-card) {
|
||||
height: 197px;
|
||||
height: 208px;
|
||||
width: 100%;
|
||||
color: #646A73;
|
||||
background-color: #FFFFFF;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<template>
|
||||
<div v-if="reloadOver">
|
||||
<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"
|
||||
:height="184"
|
||||
:height="208"
|
||||
width="100%"
|
||||
:autoresize="true"/>
|
||||
</div>
|
||||
|
@ -114,7 +114,7 @@ export default {
|
|||
icon: "rect",
|
||||
selectedMode: dataIsNotEmpty,
|
||||
itemGap: 16,
|
||||
left: '45%',
|
||||
left: '50%',
|
||||
y: 'center',
|
||||
itemHeight: 8,
|
||||
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",
|
||||
subtext: this.$t("home.dashboard.public.this_week") + ":+" + formatNumber(this.apiData.createdInWeek) + " >",
|
||||
top: "center",
|
||||
left: "86px",
|
||||
left: "100px",
|
||||
textAlign: 'center',
|
||||
textStyle: {
|
||||
rich: {
|
||||
|
@ -187,8 +187,8 @@ export default {
|
|||
series: [
|
||||
{
|
||||
type: 'pie',
|
||||
radius: ['70%', '96%'],
|
||||
center: ['92px', '50%'],
|
||||
radius: [75, 100],
|
||||
center: ['104px', '50%'],
|
||||
avoidLabelOverlap: false,
|
||||
hoverAnimation: dataIsNotEmpty,
|
||||
legendHoverLink: false,
|
||||
|
|
Loading…
Reference in New Issue