refactor(接口测试): 优化sql前后置操作放置变量
This commit is contained in:
parent
2aab424c0b
commit
3748463caf
|
@ -90,15 +90,13 @@ public abstract class SqlProcessorConverter extends MsProcessorConverter<SQLProc
|
||||||
processor.setProperty(JmeterProperty.SCRIPT_LANGUAGE, ScriptLanguageType.BEANSHELL.name().toLowerCase());
|
processor.setProperty(JmeterProperty.SCRIPT_LANGUAGE, ScriptLanguageType.BEANSHELL.name().toLowerCase());
|
||||||
|
|
||||||
StringBuilder scriptBuilder = new StringBuilder();
|
StringBuilder scriptBuilder = new StringBuilder();
|
||||||
for (KeyValueParam keyValue : extractParams) {
|
extractParams.forEach(keyValue -> {
|
||||||
if (keyValue.isValid()) {
|
String script = """
|
||||||
String script = "vars.put(\"%s\", \"%s\");\n";
|
vars.put("%s","${%s}");
|
||||||
|
""";
|
||||||
scriptBuilder.append(String.format(script, keyValue.getKey(), keyValue.getValue()));
|
scriptBuilder.append(String.format(script, keyValue.getKey(), keyValue.getValue()));
|
||||||
}
|
});
|
||||||
}
|
|
||||||
|
|
||||||
processor.setProperty(JmeterProperty.SCRIPT, scriptBuilder.toString());
|
processor.setProperty(JmeterProperty.SCRIPT, scriptBuilder.toString());
|
||||||
|
|
||||||
return processor;
|
return processor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue