Sample for how to load javascript libraries in JMeter, and use them later.
This approche can not work with JSR223 Elements.
- Load the utils.js at first by BSF Sampler
It require one parameter:
jsPath
invars
.
-
From other BSF Sampler, it is require to load the utils from
props
.//it have to be retrieved everytime from new Sampler var utils = props.get('utils');
-
load()
js files and add the functions into current context//can load more than one file once. utils.load(['moment.min']);//or utils.load('moment.min');
-
reload()
put the functions previously loaded into current contextutils.reload();
Check the example jmx file. Tested on JMeter 2.9
I put moment.js in the js folder, just for example.