Reputation: 649
I am using groovy JSR223 Post processor to process response and save to file.
Here is my configuration
in test plan adding UDV:
USER_PATH : ${__groovy(import org.apache.jmeter.services.FileServer; FileServer.getFileServer().getBaseDir();)}${__groovy(File.separator)}
JSR223 PostProcessor Script
def x = var.get ("${USER_PATH}");
out.print(x);
and i got following error in jmeter log viewer
ERROR o.a.j.e.JSR223PostProcessor: Problem in JSR223 script, JSR223 PostProcessor
javax.script.ScriptException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script18.groovy: 1: unexpected char: '\' @ line 1, column 21.
def x = var.get ("C:\Users\wins\learn\test\");
Seems groovy expected double slash from USER_PATH variable? what should i do to avoid unexpected char error from groovy?
thanks
Upvotes: 0
Views: 2891
Reputation: 168157
Your code in the JSR223 PostProcessor Script is wrong:
vars
USER_PATH
expressionOUT
shorthand is case sensitiveFixed code will be
def x = vars.get ("USER_PATH");
OUT.print(x);
More information: Apache Groovy - Why and How You Should Use It
Upvotes: 1
Reputation: 58872
You need to get by variable key and not value, change code to:
def x = vars.get("USER_PATH");
Upvotes: 1