Hi all,
I wrote a very simple BeanShell Preprocessor at the global scope. My test has
3 http samplers. The first two sampler works fine but the third has strange
warning.
Here is preprocessor beanshell code. It looks for "cid" argument and replace
it with a value from the user variables.
import org.apache.jmeter.config.Arguments;
log.info("preprocess: " + sampler.getPath());
Arguments args = sampler.getArguments();
if (args == null)
return;
log.info("before args : " + args);
if (args.getArgumentsAsMap().containsKey("cid")) {
log.info("found old cid, replace with new");
args.removeArgument("cid");
args.addArgument("cid", vars.get("CID"));
}
log.info("after args : " + args);
Here is log:
# sampler 1
2013/11/27 21:12:27 INFO - jmeter.util.BeanShellTestElement: preprocess:
/oflows/web/start.seam
2013/11/27 21:12:27 INFO - jmeter.util.BeanShellTestElement: before args :
prod=regression_checking
2013/11/27 21:12:27 INFO - jmeter.util.BeanShellTestElement: after args :
prod=regression_checking
# sampler 2
2013/11/27 21:12:28 INFO - jmeter.util.BeanShellTestElement: preprocess:
/oflows/web/start.seam;jsessionid=61BC408E510C9A3F19233A327BA11C96
2013/11/27 21:12:28 INFO - jmeter.util.BeanShellTestElement: before args :
prod=regression_checking&actionMethod=web%2Fstart.xhtml%3AapplicationManager.start&cid=108
2013/11/27 21:12:28 INFO - jmeter.util.BeanShellTestElement: found old cid,
replace with new
2013/11/27 21:12:28 INFO - jmeter.util.BeanShellTestElement: after args :
prod=regression_checking&actionMethod=web%2Fstart.xhtml%3AapplicationManager.start&cid=164
# sampler 3
2013/11/27 21:12:28 WARN - jmeter.protocol.http.sampler.HTTPSamplerBase:
Unexpected argument type: org.apache.jmeter.config.Argument
2013/11/27 21:12:31 INFO - jmeter.util.BeanShellTestElement: preprocess:
/oflows/web/apprequest.seam
Notice there are no warning in the log for sampler 1 and sampler 2. However,
sampler 3 has a warning. I have no idea where that came from.
Thanks,
James Liang
Principal Engineer
Andera Inc.
(650) 248-9294