feat(接口自动化): 完善实时执行结果

This commit is contained in:
fit2-zhao 2021-07-07 19:14:31 +08:00 committed by fit2-zhao
parent 5e4ab41e46
commit 8fb591fdc9
2 changed files with 6 additions and 3 deletions

View File

@ -2,6 +2,7 @@ package io.metersphere.api.jmeter;
import com.alibaba.fastjson.JSON;
import io.metersphere.api.dto.RunRequest;
import io.metersphere.api.dto.automation.ExecuteType;
import io.metersphere.api.dto.automation.RunModeConfig;
import io.metersphere.api.service.ApiScenarioReportService;
import io.metersphere.base.domain.TestResource;
@ -123,9 +124,11 @@ public class JMeterService {
public void runLocal(String testId, HashTree testPlan, String debugReportId, String runMode) {
init();
FixedTask.tasks.put(testId,System.currentTimeMillis());
FixedTask.tasks.put(testId, System.currentTimeMillis());
addBackendListener(testId, debugReportId, runMode, testPlan);
addResultCollector(testId, testPlan);
if (ExecuteType.Debug.name().equals(debugReportId)) {
addResultCollector(testId, testPlan);
}
LocalRunner runner = new LocalRunner(testPlan);
runner.run();
}

View File

@ -1380,7 +1380,7 @@ public class ApiAutomationService {
FileUtils.createBodyFiles(request.getScenarioFileIds(), scenarioFiles);
// 调用执行方法
jMeterService.runLocal(request.getId(), hashTree, request.getReportId(), ApiRunMode.SCENARIO.name());
jMeterService.runLocal(request.getId(), hashTree, request.getExecuteType(), ApiRunMode.SCENARIO.name());
return request.getId();
}