fix(接口测试): 修复插件步骤和脚本步骤执行报告统计不准确问题

This commit is contained in:
fit2-zhao 2022-01-25 19:25:18 +08:00 committed by fit2-zhao
parent 50a14db615
commit e2c0155cbc
2 changed files with 8 additions and 7 deletions

View File

@ -76,7 +76,8 @@ public class MsJSR223Processor extends MsTestElement {
} else {
processor.setName("JSR223Processor");
}
ElementUtil.setBaseParams(processor, this.getParent(), config, this.getId(), this.getIndex());
String resourceId = StringUtils.isNotEmpty(this.getId()) ? this.getId() : this.getResourceId();
ElementUtil.setBaseParams(processor, this.getParent(), config, resourceId, this.getIndex());
processor.setProperty(TestElement.TEST_CLASS, JSR223Sampler.class.getName());
processor.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI"));
processor.setProperty("scriptLanguage", this.getScriptLanguage());

View File

@ -11,7 +11,6 @@ import io.metersphere.base.mapper.ApiScenarioMapper;
import io.metersphere.base.mapper.ApiScenarioReportResultMapper;
import io.metersphere.base.mapper.ApiScenarioReportStructureMapper;
import io.metersphere.commons.constants.MsTestElementConstants;
import io.metersphere.commons.utils.BeanUtils;
import io.metersphere.commons.utils.CommonBeanFactory;
import io.metersphere.constants.RunModeConstants;
import io.metersphere.dto.RequestResult;
@ -81,8 +80,9 @@ public class ApiScenarioReportStructureService {
StepTreeDTO dto = null;
if (element != null && element.getBoolean("enable")) {
element = getRefElement(element);
String type = element.getString("type");
String resourceId = "JSR223Processor".equals(type) ? element.getString("resourceId") : element.getString("id");
String resourceId = StringUtils.isNotEmpty(element.getString("id"))
? element.getString("id") : element.getString("resourceId");
if (StringUtils.equals(reportType, RunModeConstants.SET_REPORT.toString())) {
if (StringUtils.isNotEmpty(resourceId) && StringUtils.isNotEmpty(apiScenario.getId()) && !resourceId.contains(apiScenario.getId())) {
resourceId = apiScenario.getId() + "=" + resourceId;
@ -116,8 +116,8 @@ public class ApiScenarioReportStructureService {
JSONObject element = hashTree.getJSONObject(i);
if (element != null && element.getBoolean("enable")) {
element = getRefElement(element);
String type = element.getString("type");
String resourceId = "JSR223Processor".equals(type) ? element.getString("resourceId") : element.getString("id");
String resourceId = StringUtils.isNotEmpty(element.getString("id"))
? element.getString("id") : element.getString("resourceId");
if (StringUtils.equals(reportType, RunModeConstants.SET_REPORT.toString())) {
if (StringUtils.isNotEmpty(resourceId) && StringUtils.isNotEmpty(id) && !resourceId.contains(id)) {
resourceId = id + "=" + resourceId;