The mobile app that I am testing with Jmeter makes 4 asynchronous API calls when logging in. Is there any way to simulate this with JMeter ?
Currently I can only get JMeter to make the calls synchronously, so when wrapping them all in the same transaction controller, the response time is the total of the 4 calls (instead of the highest one)
Many thanks
Currently JMeter doesn't offer a relevant test element, the easiest way of implementing your scenario is using JSR223 Sampler to perform nested asynchronous calls, something like:
See How to Load Test AJAX/XHR Enabled Sites With JMeter guide for more detailed explanation, code snippets,etc.
You can also consider developing a custom sampler with similar functionality and make it a part of your JMeter as a plugin or even share it with the community.
Take a look at Parallel Controller in JMeter.
All elements inside the Parallel Controller will be executed parallel to each other. This way, you will have one main flow and other flows with asynchronous requests, which will be executed in a parallel way.
https://www.blazemeter.com/blog/how-to-load-test-async-requests-with-jmeter
Related
Can someone please explain the "Limit max thread number" property for the bzm parallel controller plugin? When monitoring requests from the browser we can see there are some requests that happen in parallel. Is this property to be set to the number of requests observed occurring in parallel?
What would be the issue of not setting a limit, if the scenario is run as part of an Azure pipeline? Would it automatically determine the max number of requests that are to be executed in parallel?
Thank you.
Parallel Controller executes all it's children in parallel.
The limit is introduced to support browser-like behaviour, the majority of modern browsers open up to 6 connections to a server in order to download embedded resources and execute AJAX calls.
So if you want your JMeter test to behave more like a real browser and you're using Parallel Controller to mimic calls to embedded resources or AJAX requests you should set the limit to match the browser you're trying to simulate
I'm using JMeter for integration and non-regression testing.
The tests are automated and reports are working.
But since it is scenario testing and not performance testing the report doesn't give real business added value for that kind of tests.
My question: Is there any way to have a scenario (transaction controller based)reporting?
For the moment, to have some more meaningful result, transactions controllers and dummy sampler are used.
What we would like to have is the number of success/failure scenarios of the last test run. And also an history of success/failures per test run (1 by day).
Thank you for your advices.
The easiest way of getting the things done is putting your JMeter test under Jenkins orchestration so it will be automatically executed based on a VCS hook or according to the Schedule
Once done you will be able to utilize Jenkins Performance Plugin which adds test results trends charts and ability to mark build as unstable/failed depending on various criteria.
If I am not wrong, you want to create a suite based on particular test cases. like if single case include execution of more than 1 request in a single execution.
If this is the case, you can simple create a test fragment through jmeter gui, and copy all the samplers in single fragment.
Now to control their execution you can use any controller of your choice, i would suggest you to use module controller for http samplers.
I am new to using JMeter and have developed a basic test plan with HTTP Sampler and a few listeners. Please run me through the entire process of how I can start after opening JMeter ?
There's no right answer for this, it depends what you're wanting to achieve. I'd suggest starting with the best practices: http://jmeter.apache.org/usermanual/best-practices.html
And also look at building a web test plan: http://jmeter.apache.org/usermanual/build-web-test-plan.html
I would look at the Graphs Generator listener - https://jmeter-plugins.org/wiki/GraphsGeneratorListener/ - use these graphs to make sure you're making the number of transactions that you would expect in your tests.
Basically - the documentation is your friend. I took time to read what each controller, listener and sampler was doing and decided how to implement these myself. There was some trial and error. JMeter is an easy tool to pick up and use but there's a LOT of depth to it.
In addition to Ali1874 answer, I would suggest looking into how to run JMeter tests using command line. You can find more information at http://jmeter.apache.org/usermanual/get-started.html#non_gui. With regards to reporting JMeter is able to produce nice HTML reports when using -e -o options http://jmeter.apache.org/usermanual/generating-dashboard.html#report_after_load_test.
Also, with regards to Jmeter test plans, in my previous company we used to parameterize number of threads required, servers and other elements. In general structure looked like the one at the example test plan.
We had different user defined variables elements for different environments for faster test tuning. Also, we used bzm – Weighted switch controller (https://github.com/Blazemeter/jmeter-bzm-plugins) to distribute load among endpoints by including HTTP requests from Test Fragment element so that we would not have to duplicate requests allowing to manage them more easily. You can check out full plan at here (https://github.com/gretard/testing/blob/master/00-jmeter/results/samplePlan.jmx). Please bear in mind that test plan uses bzm – Weighted switch controller plugin and jpgc - Standard Set plugin which you can install by using Plugins manager (https://jmeter-plugins.org/wiki/PluginsManager/).
Hope this will help.
I am looking for a way to performance and stress test my SPA.
I prefer an open source(free) tool to do so.
I have searched quite a lot(https://www.blazemeter.com/blog/how-load-test-ajaxxhr-enabled-sites-jmeter) about the possibility to use Jmeter but i am still not sure if it is possible as this is an SPA and Jmeter works on the protocol level.
JMeter is not a browser as such it will not:
play URLs called through javascript.
report time taken in UI by javascript to display it
But the good news is that you can record all requests at HTTP protocol level,
all requests will be nested inside a Transaction Controller.
JMeter will play them sequentially and not in parallel.
So:
response time will be sum of Main + child requests response time
Load simulation will not be highly impacted as parallelism due to load testing will be simulated
There is also JMeter Webdriver Sampler that allows you to use a Real Browser
So by combining both approach you should be able to:
- Simulate load on your target application
- Have an idea of User Experience response times through JMeter Webdriver Sampler
You can install both plugins using JMeter-Plugins plugin manager plugin.
Note there is a 3rd party plugin that provides parallel execution if you want the parallel execution but I'm not sure it's needed:
https://github.com/Blazemeter/jmeter-bzm-plugins/blob/master/parallel/Parallel.md
By default JMeter sends all the requests sequentially. Is there any
methodology to send the requests concurrently at the same time for a single user i.e.
something similar to web_concurrent_start () and web_concurrent_end ()
functionality in Load Runner. Any thoughts / ideas in this regard?
JMeter's equivalent of the web_concurrent_start () would be Synchronizing Timer, however depending on what you're trying to achieve you may need to use a different approach.
For simulating browser's behaviour with regards to images, scripts and styles it would be using "Retrieve All Embedded Resources" and "Parallel downloads" in the HTTP Request sampler "Advanced" tab
For simulating AJAX requests you may need to do some scripting using JSR223 Test Elements and classes from i.e. java.util.concurrent namespace as JMeter Thread Groups are not designed to kick off more threads than defined.
It sounds like you need a custom sampler to fire asynchronous requests. I added some info here regarding one I am using:
Performance Testing of AJAX calls via JMeter
If your requirement is simulating browser behaviour of sending requests concurrently to load images, .css and .js files, You should have a look at the following answer:
Does a Jmeter thread really approximate a user?
You can send multiple requests in parallel by only specifying the parent URL (let's say stackoverflow.com) and enable the checkbox "Retrieve All Embedded Resources" to send requests in parallel and define concurrent pool size to specify the number of parallel requests to be sent (usually 6).
Note: JMeter parses the HTML response and triggers the requests for the resources specified in HTML response. In JMeter 3.0, it can parses .css files also, but can't parse .js files (a limitation). so, you have to take care of those requests manually (by adding HTTP samplers for those requests)