fix(接口测试): 修复接口覆盖率的统计方式,当没有接口或场景时覆盖率为0

修复接口覆盖率的统计方式,当没有接口或场景时覆盖率为0
This commit is contained in:
song-tianyang 2022-04-02 16:56:45 +08:00 committed by fit2-zhao
parent ed74ad21bb
commit eddfd7903e
2 changed files with 3 additions and 3 deletions

View File

@ -268,7 +268,7 @@ public class APITestController {
@GetMapping("/countApiCoverage/{projectId}")
public String countApiCoverage(@PathVariable String projectId) {
String returnStr = "100%";
String returnStr = "0%";
/**
* 接口覆盖率
* 接口有案例/被场景引用 所有的接口
@ -289,7 +289,7 @@ public class APITestController {
@GetMapping("/countInterfaceCoverage/{projectId}")
public String countInterfaceCoverage(@PathVariable String projectId) {
String returnStr = "100%";
String returnStr = "0%";
/**
* 接口覆盖率
* 复制的接口定义/复制或引用的单接口用例/ 添加的自定义请求 url 路径与现有的接口定义一致的请求

View File

@ -1560,7 +1560,7 @@ public class ApiAutomationService {
*/
public float countInterfaceCoverage(List<ApiScenarioWithBLOBs> allScenarioInfoList, List<ApiDefinition> allEffectiveApiList) {
if (allEffectiveApiList == null || allEffectiveApiList.isEmpty()) {
return 100;
return 0;
}
Map<ApiMethodUrlDTO, List<String>> urlMap = new HashMap<>();