0

I have a Jmeter test with multiple while controler, each looping through data in separate files I want each while loop to loop through the end of that file.

Structure:

While controller 1
  - CSV Data Config 1
  - Http sampler 1
While Controller 2
  - CSV Data Config 2
  - http sampler 2

When I set as an end condition: ${__javaScript(${myVar}!="<EOF>")} with stop thread on end of file to true, it stops the whole test completly. If I set stop on end of file to false it loops on the also, meaning it loops one time too many

Is there another way to do this? Thanks

qJake
  • 16,821
  • 17
  • 83
  • 135
Llaurick
  • 53
  • 6

2 Answers2

0

A possible solution would be use beanshell processor and find the number of records in each file. Use the number of lines as the condition to break out of the loop. Please note that you will have to use parseint in the while condition as discussed in this thread.

Community
  • 1
  • 1
Manish Sapariya
  • 3,575
  • 3
  • 25
  • 34
0

Another option could be changing your While Controller to do the infinite loop and control thread stopping via CSV Data Set Config.

As per Using CSV DATA SET CONFIG guide:

It is worth mentioning that every CSV Data Set Config is visible to all Thread Groups by default. If you need to use separate CSV Data Set Config for every Thread, you create a number of data files that you need and in every CSV Data Set Config set “Sharing mode” to “Current Thread”

So the following combination:

  • Recycle on EOF = false
  • Stop Thread on EOF = true
  • Sharing mode = Current Thread

Should do the trick for you.

Dmitri T
  • 159,985
  • 5
  • 83
  • 133