Start Thread Group immidiately without any delay - jmeter

I have some Thread Groups with Startup delay. This delay is needed in the actual execution. But while validating the Thread Group before the actual run, I don't want to wait for that delay and wants to run that Thread group immediately.
How to override the StartDelay timings for Thread Group. So that I can directly execute that command without doing any changes for testing the Thread group.

You can set Thread group's startup delay using property, for example
${__P(startupDelay , 1000}
This way delay will be 1000, unless you add startupDelay JMeter property which override (with 0 for example)

Since JMeter 3.0 there is Validate entry in the Thread Group context menu:
According to the documentation:
Validation Mode:
This mode enables rapid validation of a Thread Group by running it with 1 thread, 1 iteration, no timers and no Startup delay set to 0. Behaviour can be modified with some properties by setting in user.properties:
testplan_validation.nb_threads_per_thread_group : Number of threads to use to validate a Thread Group, by default 1
testplan_validation.ignore_timers : Ignore timers when validating the thread group of plan, by default 1
testplan_validation.number_iterations : Number of iterations to use to validate a Thread Group
testplan_validation.tpc_force_100_pct : Whether to force Throughput Controller in percentage mode to run as if percentage was 100%. Defaults to false
So you can run your Thread Group using Validate menu entry and it will ignore any startup delay and if defaults are not suitable for you they can be overriden via relevant JMeter Properties

Related

Jmeter request and report validation

My Requirement is to execute 10 request per second for 5 minutes. The configuration I have used is
Thread Group Properties:
number of threads : 600
ramp up period : 60
Loop count : 5,
Add Sampler -> Flow Control Action
Select Logical Action on thread as Pause
Duration(milliseconds) :60000
I used the below command to run jmx from command line to generate xls and generate html report.
/jmeter.sh -n -t demo.jmx -l demo.xls -e -o ./report
Need to know if the configuration I have mapped is correct or not?
I have also looked at constant throughput timer and Runtime controller to stop the execution after 5 mins?
I am not able to validate the end result?
You can see what actual throughput your test generated using Transactions Per Second listener or the relevant chart in the HTML Reporting Dashboard
With regards to configuring JMeter for sending 10 requests per second for 5 minutes I would rather recommend going for Concurrency Thread Group and Throughput Shaping Timer combination.
Configurations:

How to delay my each thread group in JMeter (without using startup delay)

Here I have 4 Thread Groups present in my Test Plan and I have a requirement, need to run test plan in the time interval of 30 minutes between each of my Thread Group (2nd thread group should start only after 30 minutes, after the completion of 1st thread group and so on).
But cannot estimate the actual duration for all my thread groups. And my Ramp-up period should be 0 for all my thread groups, is there any solution to full fill my requirement ?
Thanks in advance
Add Test Action Sampler to the end of each Thread Group
Configure it as follows:
Target: Current Thread
Action: Pause
Duration: 1800000
Add a Synchronizing Timer as a child of the Test Action sampler and set Number of Simultaneous Users to Group by to be equal to number of threads in the current Thread Group
This way Test Action sampler will act as a "rendezvous point" so all threads in the current Thread Group will sleep for 1800000 milliseconds (1800 seconds == 30 minutes), this way you will get a 30 minutes delay between Thread Groups.
Adding to #Dmitri T answer, Make sure in Test Plan the uncheck Run Thread Groups Consecutively so it won't try to execute in parallel
You can add Critical Section Controller in each Thread Group as the parent of all other components with same name (default is global_lock)
That way no Thread Group will start until previous thread ends.
EDIT
For getting result between threads:
Add to each thread group Generate Summary Results to get the result of each thread
Generates a summary of the test run so far to the log file and/or standard output.
I use like this :
Add "Flow Control Action" steps in Sampler List to the end of the Thread Groups

JMeter - In Test Plan that executes consequtive Thread Groups - How to execute particular Thread Group only once

I have a Test Plan, that executes multiple Thread Groups consequtevly - But for one of these Thread Groups I want to be executed once and on next Test Plan exection it should be ommited. Is this possible?
You can implement it as follows:
Put all the requests in your Thread Group under the If Controller and use the following expression as the "Condition"
${__groovy(!new File('somefile').exists(),)}
Add a JSR223 Sampler at the end of your Thread Group and put the following code into "Script" area:
new File('somefile').createNewFile()
If Controller checks for somefile file presence in JMeter's "bin" folder (or whatever is your current working directory) and if there is no file in it - its children will be executed.
JSR223 Sampler creates this somefile when it's being executed so next time you will run your test the condition will not be met and Thread Group will skip all its samplers. If you will need to re-enable the Thread Group - just delete this somefile
Not sure if I fully understood your requirement. If you would like to ignore a specific thread group dynamically , then you could pass the 'number of threads/users' for the thread group to 0 using properties.
more information is here - http://www.testautomationguru.com/jmeter-manage-test-plan/

Jmeter: Is it possible to run a particular thread group after all the other thread group gets completed

In JMeter, I have a requirement where I want to run a particular thread group after all the other thread groups complete their run, I know the tearDown thread group has the similar behavior but unfortunately, the logic has to be part of my regular thread.
Let's say there are 4 thread groups A,B,C & D in my test plan and I want the thread group D only to be executed after A, B & C will complete their run.
Can we achieve this without using "setup, teardown & Run groups one at a time" ??
Problem ScreenShot:
I can suggest 2 options:
Use Inter-Thread Communication Plugin. See example test plan for details.
If for some reason you are not in position to use JMeter Plugins you can achieve the same using JMeter Properties like:
When Thread Group A finishes set a JMeter Property, i.e. ThreadGroupADone=true using __setProperty() function like
${__setProperty(ThreadGroupADone,true,)}
In Thread Group D:
Add While Controller at the beginning of the Thread Group and use the following condition:
${__javaScript("${__P(ThreadGroupADone,)}"=="false",)}
Add Test Action sampler as a child of the While Controller and configure it to pause for a reasonable amount of seconds, i.e. 5 so each 5 seconds While Controller will check ThreadGroupADone property value and if it is still false - sleep for another 5 seconds. When property value will become true - Thread Group D will proceed.

Jmeter: Parallelly running Thread Group execution gets delayed

I have 3 Thread Groups: Setup Thread Group, Thread Group 2(which has the http request which does the download of the file), Thread Group 3 under a single Test Plan. The thread count=3 for each. The checkbox 'Run consecutively' is deselected in the Test plan.
The Setup thread group has all the pre-requisite requests which are needed to be executed prior to Thread Group 2 and 3. The Setup Thread Group(having multiple https requests) writes some authentication tokens to 2 different csv files which will then be utilized by the other 2 thread groups respectively when they get executed in parallel at later point of time. So, csv file1 will be used by Thread Group 2 and csv file2 will be used by Thread Group 3.
First, the Setup Thread Group gets executed.Then the Thread Group 2 and Thread Group 3 get executed in parallel. Everything seems fine when all of the threads of Setup Thread Group get the successful response:200.
But when there is any erroneous response like 500 in one of the Setup Thread Group thread Response, the csv files get less number of entries(which is fine); and the Thread Group 2 and Thread Group 3 do not run in parallel. The Thread group 3 runs first. Then after some time gap, the Thread group 2 runs. What's the cause and resolution for this problem?
1) Set Up Thread: Extract the response code or any response message of the Last sampler of the Set Up Thread.
2) Before proceeding Thread group 2 or 3 add some constant time and a BSF pre-processor. validate the condition of the extracted value(either response code/response message).
If the anticipated value is found, proceed with Thread group 2 and 3.
If not Add some constant time within the BSF(define a condition).
3) do the simlar approach, to wait for Thread Group-3 to ensure Thread Group-2 has ran succesfully.

Resources