I have several JMeter test plans which should be executed in different environments, say Dev, Test, UAT, Live. In each test plan I would like to have a simple way to specify whi
As the current solution I'm using JSR223 sampler with custom JavaScript code to set up variables from external properties-files. Something like that:
var file = new java.io.File(args[0]);
var props = new java.util.Properties();
var is = new java.io.FileInputStream(file);
props.load(is);
is.close();
for(var it = props.entrySet().iterator(); it.hasNext();)
{
var entry = it.next();
vars.put(entry.getKey(), entry.getValue());
}
Now I just need to add this code as the very first sampler in a test plan and pass environment specific filepath as the sampler parameter args[0]
it will load variables from the file and put them as JMeter variables.