Bug 49974

Summary: Allow to pause and resume tests
Product: JMeter Reporter: Luciana Moreira <moreira>
Component: MainAssignee: JMeter issues mailing list <issues>
Status: NEW ---    
Severity: enhancement CC: colin.jackson, hauser, p.mouawad, sebastian, srijondas, t.skorka
Priority: P1    
Version: 2.7   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description Luciana Moreira 2010-09-22 07:24:18 UTC
This is an RFE. It would be very interesting to be able to pause and resume tests.

We have tests that need to run for about 24 hours. It does happen that we need to restart our servers in the meantime. For such cases, instead of seeing errors in the tests results for the period that the server was down it would be more interesting to be able to pause the test for a couple of minutes and resume it thereafter.
Comment 1 Philippe Mouawad 2011-11-12 15:16:36 UTC
*** Bug 37155 has been marked as a duplicate of this bug. ***
Comment 2 colin.jackson@nzlotteries.co.nz 2012-09-13 02:29:34 UTC
Can I second the request for a "Pause Button"? 

1/. The test system is complex and requires frequent tinkering, which is difficult when running long test sequences. Additionally, the staging environment matches production, which has several scheduled events and down time which interfere with long test runs.
2/. Many long test sequences are for response metric gathering, which precludes doing any other task while the test is active (for the sake of a clean reading). It would be good to be able to pause a test run while some short task on the system is conducted, then resume.
3/. Some tasks cannot be automated, so it would be good for the tester to be able to pause the test, manually perform test steps, then resume the test.
4/. We would like to be able to pause the test and check certain aspects of the system while there is no load, then resume the load.

I would imagine that when a pause button is pressed, in-flight transactions are completed, and no new transactions are initiated. In this way, a pause would not tend to generate false-negative results.

The paused state would be indicated in the "activity light" (maybe it goes from green to amber).
Comment 3 Sebb 2012-09-13 09:32:28 UTC
The BeanShell server [1] can be used for this, in conjunction with a BeanShell test element (e.g. Timer).

Use the server to set / clear a property (or possibly a variable in bsh.shared - don't know if that works across server and threads).

The timer then checks the property; if set, it waits and loops until the property is cleared.

Obviously a dedicated test element would be easier to use, but if you need a solution now, it would be worth a try.

[1] http://jmeter.apache.org/usermanual/best-practices.html#beanshell_server
Comment 4 Sebb 2012-09-13 09:52:12 UTC
Note: any implementation needs to work for both GUI and non-GUI modes as well as client-server mode if possible.
Comment 5 Andrey Pokhilko 2016-08-11 10:05:48 UTC
IMO, This could be easily done as Timer plugin, supporting both UI and non-UI flows...
Comment 6 UbikLoadPack support 2016-08-11 11:34:23 UTC
(In reply to Andrey Pokhilko from comment #5)
> IMO, This could be easily done as Timer plugin, supporting both UI and
> non-UI flows...

Yes it's a good start. 
It could test presence of a Flag (that needs to be distributed with an api for remote testing) and sleep when state is paused and poll on it until test is resumed.
Note that some queries could fail due to timeout occuring or in case of restart , infrastructure not being warmed up.
Comment 7 Sebb 2016-08-12 11:20:19 UTC
(In reply to Andrey Pokhilko from comment #5)
> IMO, This could be easily done as Timer plugin, supporting both UI and
> non-UI flows...

Timers don't currently wait; they just return a wait time value.
The values of all timers are added up and used by the JMeter engine as the wait time.

If the Timer does not return immediately this would affect engine behaviour.

Using a Pre/Post processor might be a better solution
Comment 8 Philippe Mouawad 2018-05-21 10:10:03 UTC
*** Bug 62390 has been marked as a duplicate of this bug. ***