0

I have created a thread with three steps to:

  1. Access token request: it generates a token to be used in step three. This token is stored in a property

    ${__setProperty(accessToken,${accessToken})}

  2. Logon Get request to hit a url

  3. Logon Post request, pass some data to the url and I have set the Authorisation header using the Bearer + accessToken (the one generated in first step.

Running a single thread it works, perfect; but when I increase the number of threads, the 3 steps are not running in sequence, maybe I have some Access token before the first Logon Post and I see the token this one is using is not the token generated in the first step, it is the last one generated.

If I set a rump time longer of the total execution time it works, but then I cannot run several threads on parallel.

How can I configure the script to run the threads using the correspondent token generated in step 1 in each Post? How can I different properties or variables to store the token of every thread and use them?

Thanks.

Erik A
  • 31,639
  • 12
  • 42
  • 67

2 Answers2

0

Your issue is that you are mixing Variables and Properties.

In summary, as per functions reference:

  • Variables are per Thread
  • Properties are shared accross Threads

So don't use setProperty, just use ${accessToken}

UBIK LOAD PACK
  • 33,980
  • 5
  • 71
  • 116
0

Use property only when you want to effect all threads. Otherwise you can save variables in other variable as in User_Parameters where you put new variable name the value can be a different variable as ${accessToken}

filling in the Variable name in the 'Name:' column. To add a new value to the series, click the 'Add User' button and fill in the desired value in the newly added column.

Values can be accessed in any test component in the same thread group, using the function syntax: ${variable}.

Community
  • 1
  • 1
Ori Marko
  • 56,308
  • 23
  • 131
  • 233