To randomize form submission data in Jmeter, I've put together a sampler that selects a random element from a hard-coded list of options. The result is a variable named nextAction that can be used later in the plan. I've needed this for population of a field that has a defined set of expected values at the server.
Type: BSF Sampler
Name: set nextAction
Language: javascript
Script:
var opts = ['create','comment','update','close'];
var opt = opts[Math.floor(Math.random() * opts.length)];
vars.put("nextAction",opt);
opt
No comments:
Post a Comment