Search code examples
javatestingjmeterperformance-testingload-testing

Jmeter cleanup/ force not to abort before completely executing a group


I have a jmeter script with 1 group containing 5 requests. I need this script to run forever and will kill it manually. the problem comes when i kill it manually but it has completed only two reuest and 3-5 are not done.

eg: i am performing CRUD test. So it has created resurce ,read the resurce and I terminated script or timed script got terminated automatically. The delete will not execute and it leaves extra entry in my database. How do I prevent it?


Solution

  • Just add tearDown Thread Group to your test and add requests that delete your resources there. Here is how this element is described in help:

    "tearDown is a special type of ThreadGroup that can be utilized to perform Post-Test Actions. The behavior of these threads is exactly like a normal Thread Group element. The difference is that these type of threads execute after the test has finished executing its regular Thread Groups.

    Note that by default it won't run if Test is gracefully shutdown, if you want to make it run in this case, ensure you check option "Run tearDown Thread Groups after shutdown of main threads" on Test Plan element. If Test Plan is stopped, tearDown will not run even if option is checked."