fix(接口测试): 修复插件丢失步骤执行抛出异常问题
--bug=1015245 --user=赵勇 【接口测试】批量执行的时候在批量执行弹框里选了环境,但是提示没有环境 https://www.tapd.cn/55049933/s/1210105
This commit is contained in:
parent
af20a94e4c
commit
4e29e0be8b
|
@ -12,6 +12,7 @@ import io.metersphere.base.domain.ApiScenario;
|
||||||
import io.metersphere.base.domain.ApiScenarioWithBLOBs;
|
import io.metersphere.base.domain.ApiScenarioWithBLOBs;
|
||||||
import io.metersphere.base.domain.Schedule;
|
import io.metersphere.base.domain.Schedule;
|
||||||
import io.metersphere.commons.constants.*;
|
import io.metersphere.commons.constants.*;
|
||||||
|
import io.metersphere.commons.exception.MSException;
|
||||||
import io.metersphere.commons.utils.PageUtils;
|
import io.metersphere.commons.utils.PageUtils;
|
||||||
import io.metersphere.commons.utils.Pager;
|
import io.metersphere.commons.utils.Pager;
|
||||||
import io.metersphere.controller.request.ResetOrderRequest;
|
import io.metersphere.controller.request.ResetOrderRequest;
|
||||||
|
@ -373,12 +374,22 @@ public class ApiAutomationController {
|
||||||
|
|
||||||
@PostMapping(value = "/checkScenarioEnv")
|
@PostMapping(value = "/checkScenarioEnv")
|
||||||
public boolean checkScenarioEnv(@RequestBody ApiScenarioWithBLOBs request) {
|
public boolean checkScenarioEnv(@RequestBody ApiScenarioWithBLOBs request) {
|
||||||
return apiAutomationService.checkScenarioEnv(request);
|
try {
|
||||||
|
return apiAutomationService.checkScenarioEnv(request);
|
||||||
|
} catch (Exception e) {
|
||||||
|
MSException.throwException("场景步骤解析错误,检查是否包含插件步骤!");
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(value = "/checkScenarioEnv/{scenarioId}")
|
@GetMapping(value = "/checkScenarioEnv/{scenarioId}")
|
||||||
public boolean checkScenarioEnvByScenarioId(@PathVariable String scenarioId) {
|
public boolean checkScenarioEnvByScenarioId(@PathVariable String scenarioId) {
|
||||||
return apiAutomationService.checkScenarioEnv(scenarioId);
|
try {
|
||||||
|
return apiAutomationService.checkScenarioEnv(scenarioId);
|
||||||
|
} catch (Exception e) {
|
||||||
|
MSException.throwException("场景步骤解析错误,检查是否包含插件步骤!");
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/follow/{scenarioId}")
|
@GetMapping("/follow/{scenarioId}")
|
||||||
|
|
|
@ -347,8 +347,11 @@ public class ElementUtil {
|
||||||
public static void dataFormatting(JSONArray hashTree) {
|
public static void dataFormatting(JSONArray hashTree) {
|
||||||
for (int i = 0; i < hashTree.size(); i++) {
|
for (int i = 0; i < hashTree.size(); i++) {
|
||||||
JSONObject element = hashTree.getJSONObject(i);
|
JSONObject element = hashTree.getJSONObject(i);
|
||||||
|
if (element == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
formatSampler(element);
|
formatSampler(element);
|
||||||
if (element != null && element.get("clazzName") == null && clazzMap.containsKey(element.getString("type"))) {
|
if (element.get("clazzName") == null && clazzMap.containsKey(element.getString("type"))) {
|
||||||
element.fluentPut("clazzName", clazzMap.get(element.getString("type")));
|
element.fluentPut("clazzName", clazzMap.get(element.getString("type")));
|
||||||
}
|
}
|
||||||
if (element.containsKey("hashTree")) {
|
if (element.containsKey("hashTree")) {
|
||||||
|
|
|
@ -311,7 +311,7 @@ public class ApiScenarioEnvService {
|
||||||
builder.append(apiScenarioWithBLOBs.getName()).append("; ");
|
builder.append(apiScenarioWithBLOBs.getName()).append("; ");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
MSException.throwException("场景:" + builder.toString() + "运行环境未配置,请检查!");
|
MSException.throwException("场景:" +apiScenarioWithBLOBs.getName() +",步骤解析错误,检查是否包含插件步骤!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (builder.length() > 0) {
|
if (builder.length() > 0) {
|
||||||
|
|
Loading…
Reference in New Issue