mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-03 20:49:56 +08:00
fix(接口测试): 修复接口测试首页按照版本查询时的公式计算以及覆盖率统计错误的问题
--bug=1020896 --user=宋天阳 【接口测试】首页接口数量统计,覆盖率显示错误 https://www.tapd.cn/55049933/s/1316075
This commit is contained in:
parent
59a923dceb
commit
dc0afe9c2c
@ -103,7 +103,7 @@ public class MockApiUtils {
|
||||
} else if (StringUtils.equalsIgnoreCase(type, "XML")) {
|
||||
if (bodyObj.has("raw")) {
|
||||
String xmlStr = bodyObj.optString("raw");
|
||||
xmlStr = xmlStr.replaceAll("\r","").replaceAll("\n","");
|
||||
xmlStr = xmlStr.replaceAll("\r", "").replaceAll("\n", "");
|
||||
JSONObject matchObj = XMLUtil.xmlStringToJSONObject(xmlStr);
|
||||
returnJson = matchObj;
|
||||
}
|
||||
@ -360,7 +360,10 @@ public class MockApiUtils {
|
||||
bodyParams = new JSONArray();
|
||||
bodyParams.put(paramJson);
|
||||
} else {
|
||||
bodyParams.put(((JSONObject) paramJson));
|
||||
JSONArray oldArray = returnParams.getBodyParams();
|
||||
if (!JsonStructUtils.checkJsonArrayCompliance(oldArray, ((JSONObject) paramJson))) {
|
||||
bodyParams.put(((JSONObject) paramJson));
|
||||
}
|
||||
}
|
||||
returnParams.setBodyParams(bodyParams);
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ public class ApiHomeController {
|
||||
long effectiveApiCount = apiDefinitionService.countEffectiveByProjectId(projectId, versionId);
|
||||
long apiHasCase = apiDefinitionService.countApiByProjectIdAndHasCase(projectId, versionId);
|
||||
List<ApiDefinition> apiNoCaseList = apiDefinitionService.selectEffectiveIdByProjectIdAndHaveNotCase(projectId, versionId);
|
||||
Map<String, Map<String, String>> scenarioUrlList = apiAutomationService.selectScenarioUseUrlByProjectId(projectId, versionId);
|
||||
Map<String, Map<String, String>> scenarioUrlList = apiAutomationService.selectScenarioUseUrlByProjectId(projectId, null);
|
||||
int apiInScenario = apiAutomationService.getApiIdInScenario(projectId, scenarioUrlList, apiNoCaseList).size();
|
||||
|
||||
if (effectiveApiCount == 0) {
|
||||
@ -185,7 +185,6 @@ public class ApiHomeController {
|
||||
apiCountResult.setCoveredCount(coveredDTO.covered);
|
||||
apiCountResult.setNotCoveredCount(coveredDTO.notCovered);
|
||||
apiCountResult.setApiCoveredRate(coveredDTO.rateOfCovered);
|
||||
|
||||
return apiCountResult;
|
||||
}
|
||||
|
||||
|
@ -1669,9 +1669,11 @@ public class ApiDefinitionService {
|
||||
} else {
|
||||
ApiDefinitionExample example = new ApiDefinitionExample();
|
||||
ApiDefinitionExample.Criteria criteria = example.createCriteria();
|
||||
criteria.andProjectIdEqualTo(projectId).andStatusNotEqualTo("Trash").andLatestEqualTo(true);
|
||||
criteria.andProjectIdEqualTo(projectId).andStatusNotEqualTo("Trash");
|
||||
if (StringUtils.isNotBlank(versionId)) {
|
||||
criteria.andVersionIdEqualTo(versionId);
|
||||
} else {
|
||||
criteria.andLatestEqualTo(true);
|
||||
}
|
||||
return apiDefinitionMapper.countByExample(example);
|
||||
}
|
||||
|
@ -123,6 +123,7 @@ export default {
|
||||
tableData: [],
|
||||
currentPage: 1,
|
||||
pageSize: 5,
|
||||
versionId: '',
|
||||
total: 0,
|
||||
condition: {
|
||||
filters: {},
|
||||
@ -143,10 +144,13 @@ export default {
|
||||
}
|
||||
},
|
||||
search(versionId) {
|
||||
if (versionId) {
|
||||
this.versionId = versionId;
|
||||
}
|
||||
let projectId = getCurrentProjectID();
|
||||
this.loading = true;
|
||||
this.loadError = false;
|
||||
this.result = getRunningTask(projectId, versionId, this.currentPage, this.pageSize)
|
||||
this.result = getRunningTask(projectId, this.versionId, this.currentPage, this.pageSize)
|
||||
.then((response) => {
|
||||
this.total = response.data.itemCount;
|
||||
this.tableData = response.data.listObject;
|
||||
|
@ -156,12 +156,14 @@ export default {
|
||||
}
|
||||
},
|
||||
search(versionId) {
|
||||
this.versionId = versionId;
|
||||
if (versionId) {
|
||||
this.versionId = versionId;
|
||||
}
|
||||
let projectId = getCurrentProjectID();
|
||||
this.loading = true;
|
||||
this.loadError = false;
|
||||
|
||||
this.result = definitionWeekList(projectId, versionId, this.currentPage, this.pageSize)
|
||||
this.result = definitionWeekList(projectId, this.versionId, this.currentPage, this.pageSize)
|
||||
.then((response) => {
|
||||
this.total = response.data.itemCount;
|
||||
this.tableData = response.data.listObject;
|
||||
|
Loading…
Reference in New Issue
Block a user