How to run multiple request sequentially in Apache Jmeter - jmeter

I have an Application where i have to do load test.Its like i have request A and B,and i have to test with 10 users and request should go like first request - A,B ,second request - A,B with ramp up period 0.
Could Any one help on this.I tried doing with Simple controller but the request are sent randomly and fring error

Check the box for "Run Thread Groups Consecutively" in your test plan. It will send your request A and B for first users then for second users and so on.
See this:

If you really need to wait until 1st user is done before starting 2nd one the fastest and the easiest solution would be setting Number of Threads to 1 and loop requests A and B 10 times in your Thread Group configuration.
If for any reason you need to have 10 concurrent users but executing requests sequentially you can go for Inter-Thread Communication JMeter Plugin which allows synchronizing JMeter threads (even residing in different Thread Groups)
The recommended way of installing JMeter Plugins and keeping them up-to-date is using JMeter Plugins Manager

Related

Is it possible to simulate Once Only login but 100 concurrent users with JMeter

I'm testing a web application that only allow 5 active sessions. I want to simulate 100 concurrent REST API calls. But the below script doesn't work.
Jmeter script
Is it possible to simulate Once Only login but 100 concurrent users with JMeter?
You don't seem to be understanding what does Once Only Controller do.
It runs its child(ren) during only first iteration of the Thread Group, it doesn't execute them at the same time.
If you want to run 100 requests at the same moment - take a look at Synchronizing Timer
If in your setup 5 requests are successful and other 95 are failing you could consider logging in somewhere in setUp Thread Group and then pass the JMeter Variables holding the authentication context to the main Thread Group so all 100 threads would share the same login details.

There are many HTTP request in my jmx file ,I want to hit one HTTP request just one time irrespective of no of threads set for all

My case is-
I have to login in a website and then have to fecth a data.
For that I have created one thread group and created two HTTP request , one for login and one to fetch data.
But I want login HTTP request to HIt one time and data fetching to hit for many Virtual users.
But There is one common thread group for both.
Please help How I can sort out this?
If you need to run all requests after login in parallel, you may use Parallel Controller plugin:
Install JMeter Plugin Manager: Download plugins-manager.jar and put it into lib/ext directory, then restart JMeter.
Open menu Options -> Plugins Manager
Install Parallel Controller & Sampler plugin.
Add the Parallel Controller to the Test Plan: Right click on Thread Group -> Add -> Logic Controller -> bzm - Parallel Controller
Add your request samplers inside Parallel Controller.
Choose your Thread Group and set the number of threads (users) and loop count.
Each thread will execute the test plan in its entirety and completely independently of other test threads. Multiple threads are used to simulate concurrent connections to your server application.
So, if you want to run login sampler just once, set:
Number of Threads (users) to 1
Loop Count to 1
There are also different types of Thread Groups. Check official documentation for more information
JMeter threads (virtual users) are totally independent from each other, they use Thread Local Storage pattern for storing session information and variables therefore if you login with one user - it will be able to fetch the data, the second user will not be able to fetch the data if he isn't logged in.
If you're absolutely sure that you want to share the same login session across multiple virtual users and perform login only once consider the following test setup:
setUp Thread Group with 1 virtual user and 1 loop to perform login
Inter-Thread Communication Plugin to store the session information (i.e. Cookies) and pass it to the normal Thread Group
Normal Thread Group with as many users as you need using the data from the setUp Thread Group
Check out SynchronizationPluginsExample.jmx test plan for reference implementation.

Using jmeter not all requests processed in database, but in jmeter listener shows all requests hits the server

Using jmeter, I have 10000 users need to hit the server and to respond back with in 40 sec.
During execution (in distributed mode) only 600 users really hitting (Checked in db) in server.
But in AGGREGATE REPORT it shows all requests hits the server.
What is the issue behind this? why the number of requests hits the server isn't consistent between db and jmeter listener?
Probably your test configuration is a little bit wrong.
JMeter acts as follows:
JMeter starts all the threads (virtual users) within the bounds of ramp-up period specified in the Thread Group configuration
Each thread (virtual user) starts executing samplers upside down
When there are no more samplers to execute and no more loops to iterate the thread is being shut down.
You can check how many threads were actually active using Active Threads Over Time Listener or the same chart of the HTML Reporting Dashboard
So you may run into a situation when some samplers have already done their work and some haven't been yet started. Basically you need to provide enough loops to make sure all 10k threads will be up and running for the required test duration.
See JMeter Test Results: Why the Actual Users Number is Lower than Expected guide for more information.

Parallel file upload using jMeter

I am trying to create a jMeter script to perform file upload operation to a web application:
Test Plan
Thread Group
Launch application
Login
Navigate
Upload
Logout
In above case when we have multiple thread group then multiple files are getting uploaded. Although my requirement is to perform multiple upload operation (in parallel) in one thread operation.
How can this be done?
You only need one thread group for your requirements. Just set more users in that thread group and don't set ramp-up time. They will all login as fast as they can and do all the steps you have in your test plan. This would be the simplest way.
But, if you want all of them uploading at the exactly same moment, you can add If controller (preferably with While controller) to check if all of them have passed "Navigate" request and then enable the controller once all of them are ready for upload. This can be achieved by setting up counter which is increased when "Navigate" request is done, and once counter is equal to number of users, tell then to upload.
You cannot upload more than 1 file at a time using single thread
You cannot jump over threads number you've defined for the Thread Group
So the options are in:
Use multiple threads and Synchronizing Timer to ensure that file upload is executed at exactly the same moment
Do some scripting with i.e. JSR223 Sampler in order to trigger multiple file uploads from one thread, just like simulating AJAX calls with JMeter

Performance testing with Jmeter

I've recorded a test script of web application (extJS). The test logs into application (I used login and password saved in .txt file and CSV Data Set Config element), makes some calculations with external webservice and adds some elements to database. It works fine but...
I'm not sure that all of my users do these things at the same time... Is there any way to configure it?
E.g 100 users do the same scenario at the same time?
You can see the exact number of concurrent users via Active Threads Over Time Listener available via JMeter Plugins
If you're not happy with what you're seeing and expect more concurrent users you can consider 2 options:
Increase "Loop Count" on Thread Group level as when JMeter thread has finished executing all samplers and doesn't have any more to run and no loops to iterate - it's being shut down.
Add Synchronizing Timer. It pauses all the threads until the desired amount is reached and releases them at exactly the same moment so you will be able to test i.e. what happens when 100 users are trying to log in at the same time.

Resources