Pages

Friday 27 January 2017

JMeter - Thread Group - "tearDown Thread Group"

tearDown Thread Group is a special type of Thread Group that can be utilized to perform Post-Test actions. The behaviour of tearDown Thread Group is as similar as normal Thread Group element. The only difference is that tearDown Thread Group executes after completion of regular Thread Group execution.

Similarly, setUp Thread Group helps to perform Pre-Test activities

Note: By default, tearDown Thread Group won’t run if the Test is completed as expected. If you want to run it anyway, mark the check-box “Run tearDown Thread Groups after the shutdown of main threads” from Test Plan element.



What is the use of "tearDown Thread Group" element?
tearDown Thread Group is very much helpful to perform post-test activities like:
1. To delete test users after completion of the test
2. To delete bulk of data/order/pending request after completion of the test
3. To clear/delete dataset from a database for next run

How to add "tearDown Thread Group" element?
You can follow below steps:
1. Select "Test Plan" node
2. Right click on "Test Plan" node
3. Mouse hover "Add"
4. Mouse hover "Thread (Users)"
5. Click "tearDown Thread Group"


How to remove "tearDown Thread Group" element?
You can follow below steps:
1. Select "tearDown Thread Group" node
2. Right click on "tearDown Thread Group" node
3. Click "Remove" (Mouse) or "Delete" button from keyboard
4. Click "Yes"



What are the attributes of "tearDown Thread Group" element?
"tearDown Thread Group" has below attributes:
a.  Name: To provide WorkBench name. It may be your Test Case/Test Scenario name
b.  Comments: To provide comments
c.   Action to be taken after a Sampler error: Actions taken in case of sampler error occurs, either because the sample itself failed or an assertion failed etc. The possible choices are:
                         i.      Continue - ignore the error and continue with the test
                         ii.      Start Next Loop - ignore the error, start next loop and continue with the test
                         iii.      Stop Thread - current thread exits
                         iv.      Stop Test - the entire test is stopped at the end of any current samples.
                          v.      Stop Test Now - the entire test is stopped abruptly. Any current samplers are interrupted if possible.

d.  Number of Threads: Number of users to simulate.
e.  Ramp-up Period: How long JMeter should take to get all the threads started. If there are 10 threads and a ramp-up time of 100 seconds, then each thread will begin 10 seconds after the previous thread started, for a total time of 100 seconds to get the test fully up to speed. 
    Note: This is not the time between two threads to start-up.
f.   Loop CountNumber of times to iterate the test case. Alternatively, "forever" can be selected causing the test to run until manually stopped.
g.  Delay Thread creation until neededIf checked the box then threads are created only when the appropriate proportion of the ramp-up time has elapsed. This is most appropriate for tests with a ramp-up time that is significantly longer than the time to execute a single thread. If not checked, all threads are created when the test starts (they then pause for the appropriate proportion of the ramp-up time). This is the original default and is appropriate for tests where threads are active throughout most of the test.

h.  SchedulerCheckmark the box if you want to use the scheduler for test
i.   Start Time: If the scheduler checkbox is selected, one can choose an absolute start time. When you start your test, JMeter will wait until the specified start time to begin testing. 
    Note: the Startup Delay field over-rides start time.
j.   End Time: If the scheduler checkbox is selected, one can choose an absolute end time. When you start your test, JMeter will wait until the specified start time to begin testing, and it will stop at the specified end time. 
    Note: the Duration field over-rides end time
k.  Duration (seconds)This denotes total duration of the test. “Duration” value over-rides “End Time”, so choose either of them. One disadvantage of duration value is that test stops instantly without completing the loop (iteration) due to which you could see some differences in transaction count.

l.   Startup delay (seconds): If you provide value for “Startup delay” then it over-rides “Start Time” value. JMeter will use this to calculate the Start Time and ignore the Start Time value.

Next Topic:
set-up Thread Group

Previous Topic:
Apache JMeter - "Thread Group" Element

Related Topics:

No comments:

Post a Comment