Kyle
Kyle

Reputation: 55

JMeter - Iterative use of variables via CSV

I am having trouble, how do I put this into a JMeter test and ensure that my all Customer Numbers assigned to each Thread are being used?

My load test...

• There are 12 SOAP requests (12 x RequestTypes) that need to be sent simultaneously for each customer. A customer is distinguished by CustomerNumber in the SOAP request. For example:

<Execute>
<UserCredentials></UserCredentials>
<CustomerNumber></CustomerNumber>
<RequestType></RequestType>
</Execute>

• I have 3 thread users, and each thread user each has a designated list of customers, for example:

Thread 1 has customer list – A, D, G, J, …
Thread 2 has customer list – B, E, H, K, …
Thread 3 has customer list – C, F, I, L, …

• A thread cannot send another set of 12 SOAP request for another customer, unless a response has been retrieved for all of its previous 12 SOAP requests to a customer (it does not matter if this response is a SOAP, or application, failure)

• The CustomerNumber and respective UserCredentials will be stored in a CSV file.

• A thread user must use its own credentials in the SOAP Request.

• The requests to be sent should only finish when all the Customer Numbers for every Thread within the CSV files have been sent.

I currently have:

 Test Plan
|
 -Thread Group
   |
    - User Parameters
         *UserCredentials
         *CustomerNumbers
   |
    - Loop Controller
      |
      - Request 1
      - Request 2
      ...
      - Request 12

Within User Parameters I have the following:

Name:                User_1                        User 2                        User 3
UserCredentials      ${__CSVRead(users.csv,0)}     ${__CSVRead(users.csv,1)}     ${__CSVRead(users.csv,2)}
CustomerNumbers      ${__CSVRead(cust.csv,0)}      ${__CSVRead(cust.csv,1)}      ${__CSVRead(cust.csv,2)}

I am sending 3 thread users at one time, each sending 12 requests. Where each thread user has a list of n patients.

The problem is, I have the Loop controller set to 2, I would have expected that on the second run for each thread it would pick up the 2nd row for a CustomerNumber yet it does not.

Any help would be greatly appreciated!

Upvotes: 0

Views: 578

Answers (1)

Kyle
Kyle

Reputation: 55

To answer my own question:

Thread Group
*Number of Threads = n
*Loop Count = Forever
|
- CSV Data Set Config
  *Filename = cust${__threadNum}.csv     (where i separated my cust.csv file into n number of files)
  *Stop of thread EOF = true (others on False)
  *All threads sharing mode
- Loop Controller
  |
  - Request 1
  - Request 2
  ...
  - Request 12
  - User Parameters
    *User Credentials

Upvotes: 0

Related Questions