Parallel file upload using jMeter - 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

Related

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.

How to run multiple request sequentially in Apache 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

JMeter: How to run two thread parallel after completion of first thread

My application is live application & three is a heavy use of AAJX call and Java scripts.
Successful login required three steps
Login validation
On login page browser post user login information and backed first validate it and set cookies & session id for further use.
After successfully validation of user information browser initiate two request parallel towards back-end.
Browser post a request to server & server send some XML data in every 10 seconds towards browser. Back-end push information in every 10 seconds up to user logged in.
Also browser post a ping request to server to make sure user is available and active.
To test the performance of UI by JMeter I am planning to create following test plan.
Test Plan
Main Login Thread
Ping Thread
Application Thread
Now I want to run thread 2 & 3 parallel after completion of first thread.
Please let me know if this is possible in JMeter if Yes how I can run two threads parallel after completion of first.
It isn't something which is provided in JMeter out-of-the-box as currently there is no way to jump over the number of threads which are defined on Thread Group level so you'll need to do some coding in order to work it around, i.e.:
Use JSR223 Sampler (or PostProcessor)
Develop custom sampler i.e. basing on ExampleSampler which spawns more threads in order to simulate AJAX parallel calls
See How to Load Test AJAX/XHR Enabled Sites With JMeter article for more details and some reference implementation examples.

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.

Multiple Instances of Firefox need to be invoked through web driver sampler of Jmeter

I have created a Thread Group which has Firefox Driver Config , a Web driver Sampler and a View Results Tree Listener.
I have also added CSV Data set Config and passing username and Passwords through it to the application.
I have around 10 Credentials.
The scenario i want to do is, I want all the 10 users to login at the same time i.e 10 instances of the firefox browser to be invoked and do the job. i have given 10 in the thread group, but the users login 1 after the other.
Basically i am doing a performance testing, So i need all the 10 users to login at the same time(Simultaneously). So that 10 instances of firefox can be invoked at the same time.
Can anyone tell me, how can i achieve this in Jmeter?
Just add Synchronizing Timer to your test plan, if you need to test simultaneous login - put the timer as a child of login webdriver sampler.
I assume that you aware of recommendations from WebDriver Sampler Tutorial like
It is NOT the intention of this project to replace the HTTP Samplers included in JMeter. Rather it is meant to compliment them by measuring the end user load time.
and
JMeter allows the creation of multiple threads, and each thread is responsible for creating load on the server. However, for the Web Driver use case, the reader should be prudent in the number of threads they will create as each thread will have a single browser instance associated with it. Each browser consumes a significant amount of resources, and a limit should be placed on how many browsers the reader should create.
So it is recommended to create main load using JMeter's HTTP Request samplers and using one thread executing WebDriver Sampler to measure real-life user experience. If you still intend to create the main load with the WebDriver Sampler remember that browsers are resource-intensive so you'll need to provide something like 1 core and 1 Gb of RAM to each browser instance so make sure that machine(s) running JMeter have some capacity.

Resources