Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

How to run an JMeter test plan that it should be completed in specified time or it should be terminated within that stipulated time? Please throw me light on this question.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

It isn't possible at Test Plan level, but there are following options available:

  1. Set Duration (seconds) to the desired value for each Thread Group
  2. Use Test Action timer to stop all the threads (for example create a separate thread group, add Constant Timer which will sleep desired number of seconds, when the timer all threads will be requested to stop
  3. Use Beanshell Sampler anywhere in your script. Relevant Beanshell code to stop the test looks as follows:

    SampleResult.setStopTest(true); // to ASK threads to stop
    SampleResult.setStopTestNow(true); // to TELL threads to stop
    

Using Duration or Stop doesn't mean that your test plan will end at that moment as threads need some time to gracefully shut down.

In case of forceful termination threads may produce extra errors which will be reflected in test results.

Hope this helps.

share|improve this answer
    
can i use beanshell timer? –  Emmanuel Angelo.R Apr 28 at 12:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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