Search code examples
jmeterperformance-testing

What is the best approach to build a script with 10 users, each performing a different flow within a web app?


I want to write a script in which 10 virtual users apply load on a web app by each performing a slightly different flow, concurrently, within the same application after they log in.

I know that I can just place 10 thread groups each with 1 user and define a different flow under each thread group but then when I want to modify the number of users per any given flow, I will have to perform changes in all of the thread groups.

Is that the best approach at my disposal or is there another smarter (more easily maintainable) approach I can use?

Thanks in advance.


Solution

  • Approach with 10 thread groups should be ok, you don't have to hard-code the number of users as 1 or whatever, you can use __P() function in the Thread Group like:

    enter image description here

    If you don't provide any value it will default to 1 and in case you need to increase the number of users you will be able to put the next line to user.properties file:

    users=100
    

    and next time you run your test each Thread Group will kick off 100 virtual users resulting in 1000 total users.

    It is also possible to pass the value via -J command-line argument like:

    jmeter -Jusers=100 -n -t test.jmx -l result.jtl
    

    whatever you pass via -J command-line argument will override anything in user.properties file.

    More information:

    It is also possible to configure JMeter's virtual users to execute different Samplers or flows within the bounds of the same Thread Group by using: