2
votes

I want to test my REST service within one Test Plan and one Thread Group.

There are two methods. Let's call it getConfiguration and getDefinitionList. Both have different parameters in the URL and as header. That's why I created a CSV file for both of them. The first CSV file contains five lines for the different test cases, the second only three.

I added a CSV Data Set Config to both methods. I want JMeter to perform the first method five times and then the second, three times. Then the thread is to be terminated.

Without an additional controller, the first method is executed once, then the second one, then the first and so on. With the second one there are of course errors, because the CSV file has only three lines.

I thought a loop controller might help, but can't get it right

2

2 Answers

1
votes

Well,

  1. Put your 1st method under Loop Controller and set Loop Count to 5
  2. Do the same for 2nd method, but this time set Loop Count to 3
  3. Move CSV Data Set Config elements as children of the HTTP Request methods

    JMeter CSV Data Set Config

1
votes

You need to nest each CSV Data Set Config inside the While Controller due to Scoping rules:

And set sharing in CSV Data Set config to Current Thread Group

Example:

enter image description here

CSV Data Set configured like this , pay attention to each config:

enter image description here

While Controller1 condition :

${__jexl3("${name1}" != "",)}

While Controller1 condition : ${__jexl3("${name1}" != "",)}

${__jexl3("${name2}" != "",)}

If Controller1 condition and check "Interpret Condition as Variable Expression":

${__jexl3("${name1}" != "",)}

If Controller2 condition and check "Interpret Condition as Variable Expression":

${__jexl3("${name2}" != "",)}