Tips to confirm JMeter script is working when receiving no errors - jmeter

I am running a JMeter script to hit a web page that opens another link to a shopping cart. There are a few different urls that JMeter recorded for me using the HTTP Script Recorder. When running the JMeter script, I receive no errors in any logs ( JMeter log and a few summary report / View results tree logs ). I even added a Constant Timer to some of the pages that do actually take a few seconds to load when hitting them manually in a web browser. In the end, I cannot see what is happening, but JMeter also does not indicate any errors. How can I confirm that each url hit is actually succeeding so that the shopping cart actually gives me my item when JMeter is done?

If JMeter is able to make a http request successfully, it will be always green in View Results Tree (200 http code). It does not mean that your test is correct - ie even if the login is not successful JMeter does not report it as error/failure unless you validate the response.
I think you need assertions to ensure that the http response you get is as you are expecting.

Related

Omit the redirection responses on the html report results when running performance tests using JMeter

I'm running performance tests against a server, which uses a proxy that redirects (302) to the real backend service (api under test).
As result of that, when running the tests I get always two responses per requests (302 and 200) which is totally fine, but I wouldn't like it to be displayed in the html report that i generate using JMeter CLI:
jmeter -n -t Workbench_Performance_Test_Plan.jmx -l LoadTest/loadtest.csv -e -o LoadTest/HtmlReport -f
So these are displayed as get link by id-0 and get link by id-1
I've seen there is a way to filter by success or error in the View Results Tree or Table, but is there a way to omit those additional requests (302) using any kind of filtering without removing the errors?
Many thanks for your help.
I post my solution here in case anybody runs into the same issue.
In the Http Request Sampler there is a checkbox to force "Redirect Automatically" that has to be checked:
So in this way the published results (as well as the View Result tree output) will display only one row or item per request:

Jmeter - incorrect sample time

I have a scenario wherein i have to export the values(the details of a group of people) from a webpage either in CVS or PDF format in my desktop. The response was success When i recorded this scenario in jmeter. When i added recorded samplers in the thread group and ran them, i received success response with 302 response code. But the sample time is very less when compared with F12 time(manually captured it using F12 developer tool).
It was a POST request when i recorded it. In the results it was showing 3 different child samples out of that 1 is POST and the remaining 2 are GET requests. And 1 additional request with blank request.
The below is the structure:
1 /WebPages/Common/abc.aspx?mhsghgsjfgjsdg
-child1 (POST request)
-child2(GET request)
-child3(GET request)
1 /WebPages/Common/abc.aspx?mhsghgsjfgjsdg (blank request)
It's a C# application. Even for some other requests i am getting 302 response code with correct sample time. So i have no issues with those samples.
Could someone assist me to find out what could be the issue for the incorrect sample time? and how can i resolve it to get the correct sample time?
Appreciate your inputs or resolution.
Most probably you are not handling so called "embedded resources". Almost each HTML page contains some images, styles, scripts, fonts, etc.
In the "Advanced" tab of the HTTP Request Defaults configuration element tick:
Retrieve All Embedded Resources
Parallel Downloads
This way you will "tell" all JMeter HTTP Request samplers to download images, scripts, styles, etc. like browsers do therefore you should start getting comparable response time.
For more information on tuning JMeter so your test would be more realistic check out How to make JMeter behave more like a real browser guide.

File is not got uploaded in case script run in Jmeter

I recorded a file uploading scenario and successfully saved in web application
now when i try to run recorded script by updating "send file with request" by some other file. there is no error seems in log but file is not getting upload in web application in case i run recorded script
Please Help!
enter image description here
First of all add View Results Tree listener and inspect "Request" and "Response Data" tabs. JMeter automatically considers requests with response code < 400 as successful so even if file upload didn't happen but browser responded with HTTP Code 200 (OK) - you won't see any errors or failed tests.
Usually ability to upload a file somewhere requires being authenticated (logged in). Try adding HTTP Cookie Manager to your test plan
Sometimes application under test uses dynamic parameters which are generated in runtime. So it won't be possible to record and successfully replay scenario. If you record the same request 2 times, inspect recorded requests and see the differences - it means you'll need to perform "correlation" - process of extracting dynamic parameters from previous response and adding them to next request. The most commonly used test element for this is Regular Expression Extractor.

Data entry through Jmeter not reflected in UI of application

I'm using Jmeter to perform load test on Moodle application
I followed the below steps to replicate a simple "add company " test scenario
1: Recorded the browser actions through HTTP Test script recorder and created a test plan with thread user of 1
2: Added HTTP Cache Manager,Added regular expression extractor for retrieving dynamically generated session for login HTTP request.
For Http request of adding new company, addded user parameters containing new company name
I run the test, everything seems ok in the view results tree- response section (response code: 200,response message:OK), all the required variables are passed in the HTTP POST
PROBLEM: New company added through Jmeter test is not reflected in UI of the moodle action
Can any of you please let me know
Is there something I could be missing or anyway I can debug the problem?
P.S: I'm new to Jmeter and looked around a lot for data inputted through Jmeter not being displayed in the UI of the web application,dint find useful results.
The answer to questions of this sort is almost always that you missed some necessary dynamic value besides session ID which you did catch.
An HTTP200 response just means the server returned a "good" response. Which could also happily contain an error message.
I would check the actual html body of the returned response for any errors. Checking the log on the server side can give you clues to what went wrong sometimes. You should also try adding a cookie manager.
Run your test with 1 virtual user in GUI mode with View Results Tree listener enabled and inspect responses to see where your scripts fails. My expectation is that you simply cannot log in.
See Moodle-JMeter-LoadTest.jmx file for reference, it uses XPath Extractor to get session key and course id.
I don't think you can test using JMeter. Try JUnit Test cases instead http://jakarta.apache.org/jmeter/usermanual/junitsampler_tutorial.pdf

Jmeter - Simulate link(href) request (javascript)

I am new to Jmeter. So far I have been successful in getting Jmeter to
access my companies test site. Login and retrive results by sending
parameters. However now I have a problem.
How can I get JMETER to simulate the href click this randomly generated links? Also the link
is a popup link. An example of the link is posted below.
<a class="qmchild" href="javascript:goMenuLink(5,6);" name="SUBSearch by Batch" id="SUBSearch by Batch" style="font-weight: normal;">Search by Batch</a>
I can extract "javascript:goMenuLink(5,6)" using CSS/XPATH/REGEX but the problem is how to send that HTTP Request from JMeter as I don't the target of the href?
If it is pure javascript - there is no point in using JMeter as it does not execute Javascript. Also, It does not make sense for JMeter to execute Javascript either as it is the tool for testing the Server performance. Javascript is going to run in your Browser-local machine.
However, if it is a HTTP request, ie - when you click on this link, if it hits a server to load the pop up - you should be able to record as you did with your login request. Try to see what is sent in the http request when you click on these links - Then I am sure you would be able to figure it out!

Resources