1

I'm relatively new to Jmeter, but I have a scenario, that I've not been able to figure out where I need to perform the following:

  1. All user log in to application with a ramp-up period of 15 seconds between users.
  2. No activity continues until all users log in to application.
  3. Once all users are logged in, perform their set of business activities (will vary depending on business process, and based on iterations, not a time loop).
  4. Once all users are complete business processes, users begin to logout with ramp-down time of 15 seconds between users.

Is this possible to configure my script to execute this way and if so, how? I have tried use of Once only controllers, loop controllers, constant timers, and some various plugins (Custom Thread Groups). I've also viewed various threads and not been able to find this exact scenario, but cannot imagine this is an overly unique test case.

Any recommendations or advice is appreciated.

2 Answers 2

0
  1. Ramp-up period can be easily configured using "normal" Thread Group

  2. To "wait" until all the users are logged in use Synchronizing Timer

  3. Use Loop Controller to run the "business activities" as many times a you want

  4. The same to wait until all the users finish executing their "business activities"

  5. To implement ramp-down you can use JSR223 Timer and the following code:

    return (ctx.getThreadNum() + 1) * 15000
    

    where ctx stands for JMeterContext, see JavaDoc for all available functions and Top 8 JMeter Java Classes You Should Be Using with Groovy for more information on this and other JMeter API shorthands available for the JSR223 Test Elements.

0

The solution given by Dmitri T is right and a common approach to implement the scenario described.

Another solution could be to use BeanShell Timers to control the ramp-up and ramp-down periods, instead of JSR223 Timers. The BeanShell Timer provides access to the full power of the Java language, and allows you to write a script that calculates the desired sleep time. For example, the script to implement the ramp-down period could be similar to the JSR223 Timer example:

import java.lang.Math;

long rampDownTime = 15000;

return (int)(Math.pow(2, ctx.getThreadNum() / 10.0) * rampDownTime);

This approach will allow you to control the ramp-down time based on a logarithmic function, rather than a linear function. You can experiment with different functions to determine the best ramp-down time for your scenario.

Another approach could be to use a combination of BeanShell Timers and JSR223 Timers. For example, you could use a BeanShell Timer to control the ramp-up period, and a JSR223 Timer to control the ramp-down period.

So, there are different ways to implement the scenario described, and the best solution will depend on the specific requirements and limitations of your testing environment. It's recommended to experiment with different approaches and to evaluate the results to determine the best solution for your specific scenario.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.