Eric Olson
2012-02-10 03:07:51 UTC
Hi,
I'm having a terrible time figuring out how to share an array of strings
between different parts of my test plan. The problem I'm trying to solve
is that i want to "log in" all of my users up front to get a big list of
tokens (using OAuth 2.0), and then when I move on to the actual load
testing section of my test plan, I can just have it randomly pick a token
from my array.
The way I've been trying to do it is:
-Define an array using a BSF preprocessor (via javascript) and add it to
vars (vars.putObject("myArray",
myArray);)
-In the auth thread group, parse the response using regular expressions
putting it into a temporary variable
-In the auth thread group, use a BSF postprocessor retrieve my previously
created array and add the temporary variable from the step above to the
array, and put it back in vars
-In my test thread group, which does not start running until my auth step
is completed, each thread randomly picks from the array defined at the test
plan level.
The problem I'm running into seems to be that there is some sort of scope
issue where the data added during the auth step is not available to the
test step - only what was predefined in the top-level preprocessor. Am I
doing this completely wrong, or what? Can Arrays not be shared? If so,
how do you use data gathered from one step in the next step?
Thanks,
Eric
I'm having a terrible time figuring out how to share an array of strings
between different parts of my test plan. The problem I'm trying to solve
is that i want to "log in" all of my users up front to get a big list of
tokens (using OAuth 2.0), and then when I move on to the actual load
testing section of my test plan, I can just have it randomly pick a token
from my array.
The way I've been trying to do it is:
-Define an array using a BSF preprocessor (via javascript) and add it to
vars (vars.putObject("myArray",
myArray);)
-In the auth thread group, parse the response using regular expressions
putting it into a temporary variable
-In the auth thread group, use a BSF postprocessor retrieve my previously
created array and add the temporary variable from the step above to the
array, and put it back in vars
-In my test thread group, which does not start running until my auth step
is completed, each thread randomly picks from the array defined at the test
plan level.
The problem I'm running into seems to be that there is some sort of scope
issue where the data added during the auth step is not available to the
test step - only what was predefined in the top-level preprocessor. Am I
doing this completely wrong, or what? Can Arrays not be shared? If so,
how do you use data gathered from one step in the next step?
Thanks,
Eric