Introduction
This page shows how to change what values you are getting for each action execution
Default behavior
Each of the supported patterns comes with several different constructors and some of them allow you to set the parameter provider level, while others do not.
The following example will maintain a single user for each thread
new ListDataConfig( PARAMETRIZED_USER, new String[]{ "vuser10", "vuser11", "vuser12" } );
while the next example does not care about threads but just gives the next available username.
new ListDataConfig( PARAMETRIZED_USER, new String[]{ "vuser10", "vuser11", "vuser12" }, ParameterProviderLevel.PER_INVOCATION );
Set the provider level after constructing the parameter pattern
You can always explicitly set the level using the setParameterProviderLevel method.
Here is how:
// create the configurator using any available constructor ListDataConfig usersConfigurator = new ListDataConfig( PARAMETRIZED_USER, new String[]{ "user1", "user2", "user3" } ); // set the needed provider level usersConfigurator.setParameterProviderLevel( ParameterProviderLevel.PER_INVOCATION ); // pass this configurator to the load client loader.addParameterDataConfigurator( usersConfigurator );
Possible options
We will show these options using an example.
Let's say we are running 2 threads with 3 possible values for username. The possible usernames are "user1", "user2" and "user3"
Parameters per thread
Here is the result when using ParameterProviderLevel.PER_THREAD
iteration |
thread 1 |
thread 2 |
1 |
user1 |
user1 |
2 |
user2 |
user2 |
3 |
user3 |
user3 |
4 |
user1 |
user1 |
As you can see each thread will cycle through the available values without messing with the other threads.
When all the values are over, the thread will start pulling them from the beginning.
Static parameters per thread
Here is the result when using ParameterProviderLevel.PER_THREAD_STATIC
iteration |
thread 1 |
thread 2 |
1 |
user1 |
user2 |
2 |
user1 |
user2 |
3 |
user1 |
user2 |
4 |
user1 |
user2 |
As you can see each thread gets assigned some value and keeps using only this value, no matter how many iterations are executed.
This is the expected way when parametrizing the username as usually, each thread represents one user during all iterations.
If we had a third thread, it would get assigned the "user3". If we had a fourth thread, it would get assigned the "user1" and so forth.
Parameters per invocation
Here is the result when using ParameterProviderLevel.PER_INVOCATION
iteration |
thread 1 |
thread 2 |
1 |
user1 |
user2 |
2 |
user3 |
user1 |
3 |
user2 |
user3 |
4 |
user1 |
user2 |
As you can see here, there is no separation between threads. Each new value is passed to whoever requested it.
Back to parent page
Go to Table of Contents