Close

October 1, 2013

How to run JMeter test plan for specified amount of time?

In this blog post we will see about How to run JMeter test plan for specified amount of time? There are two ways to specifying certain amount of time to run JMeter test plan.

Technique 1

  • In the Thread Group element, check Scheduler and specify the Duration in seconds. E.g. if you want to run JMeter test plan for 30 minutes then enter 1800 (30 x 60 = 1800) as shown below.

[auto_thumb width=”150″ height=”150″ link=”” lightbox=”true” align=”center” title=”How to run JMeter test plan for specified amount of time – Technique 1″ alt=”How to run JMeter test plan for specified amount of time – Technique 1″ iframe=”false” frame=”true” crop=”true”]http://qainsights.com/wp-content/uploads/2013/10/How-to-run-JMeter-test-plan-for-specified-amount-of-time-Technique-1.jpg[/auto_thumb]

  • Enter Startup delay as zero. If the Scheduler is checked, JMeter will calculate the Startup delay value and ignore Start Time.

Technique 2

  • Create a Thread Group which should contain your actual samplers. Use below options for your main Thread Group.

[auto_thumb width=”150″ height=”150″ link=”” lightbox=”true” align=”center” title=”How to run JMeter test plan for specified amount of time – Technique 2 – Main Thread Group” alt=”How to run JMeter test plan for specified amount of time – Technique 2 – Main Thread Group” iframe=”false” frame=”true” crop=”true”]http://qainsights.com/wp-content/uploads/2013/10/How-to-run-JMeter-test-plan-for-specified-amount-of-time-Technique-2-Main-Thread-Group.jpg[/auto_thumb]

  • Add one more Thread Group with below settings

[auto_thumb width=”150″ height=”150″ link=”” lightbox=”true” align=”center” title=”How to run JMeter test plan for specified amount of time – Technique 2 – Dummy Thread Group” alt=”How to run JMeter test plan for specified amount of time – Technique 2 – Dummy Thread Group” iframe=”false” frame=”true” crop=”true”]http://qainsights.com/wp-content/uploads/2013/10/How-to-run-JMeter-test-plan-for-specified-amount-of-time-Technique-2-Dummy-Thread-Group.jpg[/auto_thumb]

  • Now add 2 Test Action samplers, by right clicking on your dummy Thread Group > Add > Sampler > Test Action as shown below

[auto_thumb width=”150″ height=”150″ link=”” lightbox=”true” align=”center” title=”How to run JMeter test plan for specified amount of time – Technique 2 – Add Test Action Sampler” alt=”How to run JMeter test plan for specified amount of time – Technique 2 – Add Test Action Sampler” iframe=”false” frame=”true” crop=”true”]http://qainsights.com/wp-content/uploads/2013/10/How-to-run-JMeter-test-plan-for-specified-amount-of-time-Technique-2-Add-Test-Action-Sampler.jpg[/auto_thumb]

  • Click on Test Action 1 and enter below settings. Select Target as Current Thread and Action as Pause and enter 1800000 milliseconds (30 minutes duration). This sampler acts as a Pause.

[auto_thumb width=”150″ height=”150″ link=”” lightbox=”true” align=”center” title=”How to run JMeter test plan for specified amount of time – Technique 2 – Test Action Sampler 1″ alt=”How to run JMeter test plan for specified amount of time – Technique 2 – Test Action Sampler 1″ iframe=”false” frame=”true” crop=”true”]http://qainsights.com/wp-content/uploads/2013/10/How-to-run-JMeter-test-plan-for-specified-amount-of-time-Technique-2-Test-Action-Sampler-1.jpg[/auto_thumb]

  • Click on Test Action 2 Sampler and specify below settings. Target as All Threads and Action as Stop. This sampler stops the execution once it reaches the specified duration.

[auto_thumb width=”150″ height=”150″ link=”” lightbox=”true” align=”center” title=”How to run JMeter test plan for specified amount of time – Technique 2 – Test Action Sampler 2″ alt=”How to run JMeter test plan for specified amount of time – Technique 2 – Test Action Sampler 2″ iframe=”false” frame=”true” crop=”true”]http://qainsights.com/wp-content/uploads/2013/10/How-to-run-JMeter-test-plan-for-specified-amount-of-time-Technique-2-Test-Action-Sampler-2.jpg[/auto_thumb]

P.S: Make sure you unchecked Run Thread Groups consecutively option in Test Plan.

Thanks for visiting QAInsights! Check out our new portal Testifications.com to get updates on Software Testing related certifications. We’re always posting interesting articles on QAInsights. I request you to subscribe so you don’t miss out anything.

Searching for QA Jobs Openings, check it at www.QAJobOpenings.com

Want to start a blog like this, please visit SpidyDomain to buy cheap web hosting and register domain.

Subscribe to our QAInsights YouTube Channel | Subscribe our free weekly newsletter

About NaveenKumar Namachivayam

Hi there! is a passionate and experienced Performance Test Analyst based in Chicago, USA with skill sets in Manual Testing, Test Automation, Performance Testing, and Test Estimation. He loves to learn and experiment new trends and models in Software Testing. Please stop by at his personal blogs: Excel Blog, DealsBrook, NaveenKumarN.in, and Affiliate Insights blog and Software Testing Memes.

Leave a Reply

Your email address will not be published. Required fields are marked *