1

I have two CSV files, test1.csv and test2.csv. These two tests are slightly different, but I want to test them through the same test plan and report on them together. Therefore, I thought I would create two test fragments.

enter image description here

I have a thread group called 10 Concurrent Users because it's a thread group that will have 10 threads. I want this thread group to first run the Test 1 Test Fragment and then Test 2 Test Fragment. I want each test fragment to end after the corresponding CSV file reaches EOF.

I understand I can set Stop thread on EOF to true, but I don't want to stop the thread. I just want to "end" this test fragment. How do I do this?

This is what my Thread Group looks like. I don't want it to run infinitely, and I don't want to hard code the number of iterations. enter image description here

One way I found was to just have two separate thread groups. One thread group for the first CSV file and one thread group for the second CSV file. Set the Thread Groups to "Infinite" and have "Stop Thread on EOF" set to true for each Data Set Module. However, it would be nice to not have to have separate thread groups as they are just duplicates of each other

Ori Marko
  • 56,308
  • 23
  • 131
  • 233
Eric
  • 2,008
  • 3
  • 18
  • 31
  • One way I found was to just have two separate thread groups. One thread group for the first CSV file and one thread group for the second CSV file. Set the Thread Groups to "Infinite" and have "Stop Thread on EOF" set to true for each Data Set Module. However, it would be nice to not have to have separate thread groups as they are just duplicates of each other. – Eric Jul 26 '21 at 05:00

2 Answers2

1

In same thread group define a While Controller per CSV Data Set Config

Define in While's condition the value you get from CSV

Define an while controller with the Condition as ${url}

And don't recycle list on EOF:

To stop execution after the end of the CSV file is reached: within the CSV Data Set Config set Recycle on EOF? = False and Stop thread on EOF? = True.

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

If you want to iterate all the values in the CSV file and then continue you can configure the CSV Data Set Config like:

enter image description here

and put your Sampler(s) under the While Controller using the following __jexl3() function as the condition:

${__jexl3("${myVar}" != "<EOF>",)}

Another option is putting the logic under the Loop Controller, the number of lines in the CSV file can be determined dynamically using the following __groovy() function

${__groovy(new File('/path/to/your/file.csv').readLines().size(),)}
Dmitri T
  • 159,985
  • 5
  • 83
  • 133