Pages

Friday, 27 January 2017

JMeter - Thread Group - "setUp Thread Group"

setUp Thread Group is a special type of Thread Group that can be utilized to perform Pre-Test actions. The behaviour of setUp Thread Group is as similar as normal Thread Group element. The only difference is that setUp Thread Group executes before the test proceeds to execute regular Thread Group.

Similarly, tearDown Thread Group helps to perform Post-Test activities

What is the use of "setUp Thread Group" element?
setUp Thread Group is very much helpful to perform pre-test activities like:
1. To create new users by doing the sign-up activity
2. To get a large dataset from a database into a JMeter variable that can be used during the test
3. To get and log the version number from the system under tests version number.
4. To run a javascript to set JMeter properties based on more simple input parameters/properties. Let's say you want to configure the selection of target host a simple true/false value, but in your test, you need to expand it to different strings, and you do not want to have logic spread out all over your test plan.
5. To apply some pre-test condition based on that Thread Group (Test Case) will be selected.

How to add "setUp 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 "setUp Thread Group"



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


What are the attributes of "setUp Thread Group" element?
"setUp 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:
Ultimate Thread Group

Previous Topic:
tearDown Thread Group

Related Topics:

1 comment: