Jmeter variables are essentially just key/value pairs stored in a big hash
table. There's nothing magical about arrays in jmeter, they just get a
_number extension on them. You can very easily write one of these with a
BSF sampler You just need to keep in mind that they start at one.
int i;
for(i = 1; i < 42; ++i) {
vars.put("myarray_" + Integer.toString(i), Integer.toString(i));
}
vars.put("myArray_#", Integer.toString(i));
That's off the top of my head so please forgive me if it has syntax errors.
You can read them in the same way.
Since Jmeter variables are this way, the Object you stored in the Jmeter
variable is a reference. Therefore, you should not ever need to put it
again after you store it the first time. Just get the object in your BSF
sampler and push values into it and the array in vars will change.
That being said, I honestly don't see why your test doesn't work. It looks
to me like it should. There' s no harm in re-putting the array reference.
You can also open a File and write a comma delimited file from within the
BSF sampler. I prefer to use groovy in my BSF samplers, but I write my
files like a Java programmer because I'm not entirely comfortable with
everything that Groovy does. It's atrocious (my code, not groovy.) Just
google on opening and writing files with whatever language you're using. It
should put the file in your current test directory, if I recall correctly.
--
Bruce Ide
[email protected]