I have a Simple Test Plan:
Thread Group
Runtime Controller
Dummy Sampler
JSR223 Post Processor
Which works fine, unless I uncheck the Simulate response time(sleep) checkbox
Then It sends more than 300 request per seconds! (I see it using log in my post processor)
Without controller it works fine and also with different controller as Simple Controller
I didn't find in Dummy Sampler documentation any indication of such behavior.
Should this checkbox never be uncheck under Runtime controller?
I'm not sure if it's a bug in JMeter or plugin or just wrong settings.
Runtime Controller runs samplers inside it until your reach the configured "Runtime" attribute value.
So if you uncheck in Dummy Sampler the "Simulate response time(sleep)", you'll end up having this sampler return nearly immediately and as a consequence execute much more in the configured time than if it's unchecked.
So I would say, configuration issue.
JMeter documentation has been improved following your question:
http://svn.apache.org/viewvc?rev=1813452&view=rev
Related
I have saved the HTTP Header Manager information for an endpoint as below:
However, when i execute this test plan i see in the test results tree view, many of the hits fail. I figure from the response headers i see there that it is using the header value i had put in earlier.
Why are these history values being used? How do i get rid of it.
Check the request start time, it might be the case you're looking at "old" results and you need to scroll down to see "new" results. Alternatively you can invoke Clear all menu entry which will remove all the previous results, logs, etc.
Running tests in GUI mode should only be used for development and debugging, for your 100 threads you should switch to command-line non-GUI mode
Also when you're done with designing your test consider removing all the listeners as they don't add any value and just consume valuable resources. More information: Reducing resource requirements
I assume you have a Header Manager for the specific http request (HTTP Sampler). You need to override the values in the individual HTTP Sampler's Header Manager. JMeter follows hierarchy where you can override values at node level.
I am running a simple login and logout test in JMeter for our application.
I have disabled some initial steps in the thread and run the tests which still runs without any problem.
The tests that are running successfully should not be running as they are dependent on login step.
Can someone help me clarify this doubt?
Add as a parent an If Controller for the dependent samplers,
You can easily mark requests and
Right Click -> Insert Parent -> Logic Controller -> If Controller
Check that login wasn't failed using condition:
${JMeterThread.last_sample_ok}
JMeters Samplers are independent, JMeter doesn't "read" its labels and "think" that "well, login is disabled, I will not run dashboard", it just executes enabled Samplers upside down (or according to the logic controllers)
With regards to this "The tests that are running successfully" statement: how do you know that they're running successfully and doing what they're supposed to be doing?
If you're relying on JMeter as well be informed that JMeter automatically treats all the HTTP Request samplers which return status code below 400 as successful.
Try adding Response Assertion to each samplers and introduce explicit checks for the text which each page must contain just as an extra layer of confidence so JMeter would conditionally fail the sampler if it will not find the associated text at the page
I want to do load test as well as performance test a website and I have recorded user step by step action through jmeter recording by proxy setting. And when I run this recorded test it gets passed all the sections except one section.
During recording steps, it gets filled all the required fields like POST, GET, PATH etc by default as well as like token, session id etc in the HTTP header manager. When user login again its get unique session id and token through Regular Expression Extractor. But my test gets failed when the user wants to accept a task it says unauthorized. I have attached screenshot.
This image showing all the steps user will do from login to logout.
Here steps 2.9 section gets fail.
Here its showing the response from the server.
Please let me know where am I doing wrong.
There are multiple possible issues with your test:
Location of the Regular Expression Extractor and other Post and Pre-Processors. According to JMeter Scoping Rules they are applied to all your Samplers so please double check if this is something you're looking for. If you want to apply the Post-Processor to a single sampler - you need to move it to be a child of the particular sampler
Since JMeter 3.1 it's recommended to use JSR223 Test Elements and Groovy language for scripting so consider converting your Beanshell test elements into JSR223 ones
Since JMeter 3.0 there is JSON Extractor which you should be using instead of the plugins
In general HTTP status 401 means Unauthorized so double check that your test is doing what it is supposed to be doing using View Results Tree listener. You might also want to double check JMeter Variables values using Debug Sampler as it might be the case that the variables are being overwritten with something you don't expect due to the aforementioned Scoping Rules potential issue
I have recorded a user journey in JMeter (using AngularJS). When I click a link that spawns a GET request to a page, in-turn it spawns additional sub-requests to some page resources (images).
In Short:
Test Plan
-- Thread Group
---- Transaction Controller
------ HTTP Request (Main sample)
Here the main sample triggers additional sub-samples for resources and they fail due to path issues however this works manually using a browser.
I am in need to change the path of the sub-samples or not fail on a 404 for these sub-samples.
The fact you are getting different results in browser and JMeter indicates that your JMeter test is not well-behaved as it doesn't replicate browser requests with 100% accuracy therefore your load test doesn't make a lot of sense as "good" load tests must represent real user sitting behind real browser as close as possible. I would recommend comparing requests which are being sent from browser and JMeter with a sniffer tool like Fiddler or Wireshark, identify the differences and amend JMeter configuration so JMeter-driven requests would be exact replica of browser-driven ones (apart from dynamic parameters)
For the time being I can tell you only how to convert failed sub-samples into successful ones.
Add JSR223 PostProcessor as a child of your main request
Put the following code into "Script" area:
prev.getSubResults().each {
it.setSuccessful(true)
}
That's it, the above Groovy code will mark all sub-samples as successful no matter of original status (the response status code, message, body, etc. will remain original, JMeter just won't consider them as failed anymore). See Apache Groovy - Why and How You Should Use It article to learn more about using Groovy scripting in JMeter tests.
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.
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.
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:
Note from image:
All direct child elements of this controller will be executed as parallel.
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");
}