Hi variables are scoped to the thread. a. Use properties (but you'd have to represent the array as a delimited string (also described in same link s step c) b. Do you need randomness (or will sequential work) - if sequential works then in a setup threadgroup write these values to a CSV , which is then picked up by the next thread group using CSV data set config c. use BSH shared namespace -- http://jmeter.apache.org/usermanual/best-practices - sharing variables
regards deepak On Thu, Feb 9, 2012 at 7:07 PM, Eric Olson <[email protected]> wrote: > 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 >
