1

We have user defined variable name as "search".

I am using below line to write in csv file in beanshell postprocessor but its showing me "void" in csv file:

print(${search});

please help.

Anonymous
  • 109
  • 2
  • 12

1 Answers1

2
  1. Since JMeter 3.1 you should be using JSR223 Test Elements and Groovy language for scripting therefore consider switching to Groovy
  2. Don't refer JMeter Functions and/or Variables in scripts directly as it might cause unexpected behavior or script malfunction. Either use "Parameters" tab or go for code-based equivalents
  3. Beanshell print() function basically writes the value to STDOUT, if you want to write the value to a file you should do it differently.

Assuming all above you should be using something like:

new File("/path/to/your/file.csv") << vars.get("search")

More information: Apache Groovy - Why and How You Should Use It

Dmitri T
  • 159,985
  • 5
  • 83
  • 133