fix(接口测试): 修复beanshell断言生成失败的缺陷
--bug=1027705 --user=王孝刚 【接口测试】github#25504,beanshell 脚本断言,在不勾选 JSR223 时,断言结果恒为真 https://www.tapd.cn/55049933/s/1391820
This commit is contained in:
parent
f5e09b8e4d
commit
8f2c189efe
|
@ -192,18 +192,15 @@ public class MsAssertions extends MsTestElement {
|
|||
}
|
||||
|
||||
private TestElement jsr223Assertion(MsAssertionJSR223 assertionJSR223) {
|
||||
TestElement assertion = new BeanShellAssertion();
|
||||
if (assertionJSR223.getJsrEnable() == null || BooleanUtils.isTrue(assertionJSR223.getJsrEnable())) {
|
||||
assertion = new JSR223Assertion();
|
||||
}
|
||||
TestElement assertion = new JSR223Assertion();
|
||||
assertion.setEnabled(this.isEnable());
|
||||
if (StringUtils.isNotEmpty(assertionJSR223.getDesc())) {
|
||||
assertion.setName("JSR223" + delimiter + this.getName() + delimiter + assertionJSR223.getDesc() + delimiterScript + assertionJSR223.getScript());
|
||||
} else {
|
||||
assertion.setName("JSR223" + delimiter + this.getName() + delimiter + "JSR223Assertion" + delimiterScript + assertionJSR223.getScript());
|
||||
}
|
||||
assertion.setProperty(TestElement.TEST_CLASS, JSR223Assertion.class.getName());
|
||||
assertion.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI"));
|
||||
assertion.setProperty(TestElement.TEST_CLASS, JSR223Assertion.class.getName());
|
||||
assertion.setProperty("cacheKey", "false");
|
||||
String scriptLanguage = assertionJSR223.getScriptLanguage();
|
||||
if (StringUtils.equals(scriptLanguage, "nashornScript")) {
|
||||
|
@ -215,6 +212,12 @@ public class MsAssertions extends MsTestElement {
|
|||
if (StringUtils.equals(scriptLanguage, "javascript")) {
|
||||
scriptLanguage = "rhino";
|
||||
}
|
||||
if (StringUtils.equals(scriptLanguage, "beanshell") && BooleanUtils.isFalse(assertionJSR223.getJsrEnable())) {
|
||||
assertion = new BeanShellAssertion();
|
||||
scriptLanguage = "beanshell";
|
||||
assertion.setProperty(TestElement.TEST_CLASS, BeanShellAssertion.class.getName());
|
||||
assertion.setProperty(BeanShellAssertion.SCRIPT, assertionJSR223.getScript());
|
||||
}
|
||||
assertion.setProperty("scriptLanguage", scriptLanguage);
|
||||
assertion.setProperty(ElementConstants.SCRIPT, assertionJSR223.getScript());
|
||||
return assertion;
|
||||
|
|
|
@ -482,6 +482,10 @@ public class ApiScenarioExecuteService {
|
|||
if (testElement != null) {
|
||||
apiScenario.setName(testElement.getName());
|
||||
apiScenario.setScenarioDefinition(JSON.toJSONString(testElement));
|
||||
List<String> projectIdLists = getProjectIds(apiScenario.getScenarioDefinition());
|
||||
Map<String, String> envMap = getProjectEnvMap(projectIdLists, request.getEnvironmentMap());
|
||||
request.getConfig().setEnvMap(envMap);
|
||||
report.setEnvConfig(JSON.toJSONString(request.getConfig()));
|
||||
apiScenarioReportStructureService.save(apiScenario, report.getId(), request.getConfig().getReportType());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue