Performance Testing of AJAX calls via JMeter
Asked Answered
B

3

5

I am doing performance testing for an application that has AJAX calls. I am able to record the same requests but unable to execute them. Can anyone help me in execute the AJAX requests, please?

Do I need to use any extra plugin for this? If yes, what are they and how to I use them.

Britney answered 3/9, 2014 at 9:40 Comment(0)
W
1

This one worked for us - we just put multiple HTTP Request samplers directly under it:

https://github.com/Blazemeter/jmeter-bzm-plugins/blob/master/parallel/Parallel.md

From the link:

enter image description here

Note from image:

All direct child elements of this controller will be executed as parallel.

Wiseman answered 12/11, 2019 at 14:55 Comment(0)
S
8

I'm not aware of any existing plugins which are capable of handling AJAX calls. Technically AJAX requests are basic HTTP Requests but they need to be executed in parallel using one extra thread per call.

For the moment it is not possible to have nested thread groups in JMeter so you'll have to do some extra coding using JSR223 Sampler to kick off AJAX requests. Main request and nested AJAX calls should be placed under Transaction Controller to look like a real-browser behavior.

Alternatively you can develop your own JMeter Sampler which will be able to spawn extra threads to simulate AJAX requests.

For details on 2 approaches above see How to Load Test AJAX/XHR Enabled Sites With JMeter guide.

Saga answered 3/9, 2014 at 10:8 Comment(1)
Thank you Dmitri T for your help. :-)Britney
E
1

Although it looks a bit dormant, I built this sampler and it is working fine for me. It creates a single sampler that you can add multiple requests to and they are all fired in parallel. Cookie/header managers/variables are available to the requests:

https://github.com/blackboard/jmeter-common/tree/master/src/main/java/blackboard/jmeter/sampler/ConcurrentHttpRequests

p.s. I added a line to the processResult method in ConcurrentHttpRequestsSampler.java to write the response body to a jmeter variable prefixed with the sub-sample name, as the response bodies from the sub requests aren't available to post-processors on the ConcurrentHttpRequests sampler:

try{
    jmeterContextOfParentThread.getVariables().put(subResult.getSampleLabel()+"_responseBody",new String(subResult.getResponseData(),"UTF-8"));
  }
  catch(java.io.UnsupportedEncodingException e) {
    jmeterContextOfParentThread.getVariables().put(subResult.getSampleLabel()+"_responseBody","Unable to read response data");
  }
Elnoraelnore answered 4/10, 2016 at 9:2 Comment(4)
how to use it..can u please tell me some step..I am beginner to jmeter and at first page I have to test the ajax callssForedo
2. Build the new sampler using mavenElnoraelnore
3. Copy the compiled sampler into your jmeter\lib\ext folderElnoraelnore
4. New sampler should now be available from within the JMeter GUIElnoraelnore
W
1

This one worked for us - we just put multiple HTTP Request samplers directly under it:

https://github.com/Blazemeter/jmeter-bzm-plugins/blob/master/parallel/Parallel.md

From the link:

enter image description here

Note from image:

All direct child elements of this controller will be executed as parallel.

Wiseman answered 12/11, 2019 at 14:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.