Reputation: 161
I'm trying to create a file which contains a Regex variable. I'm using BeanShell PostProcessor to create the file which add values from the vars. I want to add it to If controller so it will add the value to the file only if a condition comes out as True.
My BeanShell code is:
artLink = vars.get("artLink");
// If you want to overwrite, then don't pass the second argument
f = new FileOutputStream("result3.csv", true);
p = new PrintStream(f);
this.interpreter.setOut(p);
print(artLink);
f.close();
When I take the BeanShell out of the If Controller, it creates a file, but when I put it back, no file is being created. So I guess the problem is with the If condition.
My If condition is:
"${notFound}"=="AA"
The "notFound" is the regex var and "AA" is the default value.
So my question is if BeanShell PostProcessor can't be done under If controller, or is it my IF condition which makes the problem?
Upvotes: 0
Views: 1197
Reputation: 168122
Beanshell Post Processor won't be executed if there are no other Samplers under the If Controller.
So the options are:
See How to use BeanShell: JMeter's favorite built-in component guide for more information on Beanshell scripting in Apache JMeter and a kind of Beanshell cookbook.
Upvotes: 1