fix(测试计划): 统一性能测试执行错误消息

This commit is contained in:
fit2-zhao 2021-07-02 12:23:52 +08:00 committed by fit2-zhao
parent 542b2796e1
commit 3072ddf3a3
1 changed files with 13 additions and 15 deletions

View File

@ -135,23 +135,21 @@ public class TestPlanLoadCaseService {
} }
public void runBatch(RunBatchTestPlanRequest request) { public void runBatch(RunBatchTestPlanRequest request) {
if (request.getConfig() != null && request.getConfig().getMode().equals(RunModeConstants.SERIAL.toString())) { try {
try { if (request.getConfig() != null && request.getConfig().getMode().equals(RunModeConstants.SERIAL.toString())) {
serialRun(request); serialRun(request);
} catch (Exception e) { } else {
String message = e.getMessage(); ExecutorService executorService = Executors.newFixedThreadPool(request.getRequests().size());
if (StringUtils.isNotEmpty(message)) { request.getRequests().forEach(item -> {
message = message.replace("io.metersphere.commons.exception.MSException:", ""); executorService.submit(new ParallelExecTask(performanceTestService, testPlanLoadCaseMapper, item));
MSException.throwException(message); });
}else{ }
MSException.throwException("请求参数错误,请刷新后执行"); } catch (Exception e) {
} if (StringUtils.isNotEmpty(e.getMessage())) {
MSException.throwException("测试正在运行, 请等待!");
} else {
MSException.throwException("请求参数错误,请刷新后执行!");
} }
} else {
ExecutorService executorService = Executors.newFixedThreadPool(request.getRequests().size());
request.getRequests().forEach(item -> {
executorService.submit(new ParallelExecTask(performanceTestService, testPlanLoadCaseMapper, item));
});
} }
} }