How JMeter tests web application - jmeter

I made load test on my web application with JMeter using HTTP Proxy. In HTTP Request I insert some data which I want to change. After load test when I go to the web page the page was without changes and I get all results(graph and table). Is that test real or not? Because was without page (data) changes?

Use the "tree view" LISTENER to see what request you sent to your web application. That will tell you if Jmeter was sending the new data, or just sending what you recorded. If Jmeter sent new data, then your application probably has a problem. If Jmeter sent the old recorded data, then you need to update your script by going to the request and changing the parameters.

Related

504 Gateway timeout in Jmeter

During manual run on reaching the Home screen, the page keeps loading and the API calls timeout with 504 error(Received the same error during Jmeter execution)
But if the same page(Home screen) is refreshed three times manually, all the previously timed out APIs load successfully (status:200).
But I'm unable to identify how to refresh the page using Jmeter. Any help on this? Thanks!
I tried adding JSR223 preprocessor with the following Javascript -
load("API-url") in the script section but it doesn't seems to work.
As per JMeter project main page:
JMeter is not a browser, it works at protocol level. As far as web-services and remote services are concerned, JMeter looks like a browser (or rather, multiple browsers); however JMeter does not perform all the actions supported by browsers. In particular, JMeter does not execute the Javascript found in HTML pages. Nor does it render the HTML pages as a browser does (it's possible to view the response as HTML etc., but the timings are not included in any samples, and only one sample in one thread is ever displayed at a time).
So in order to "refresh" the page you need to send the same HTTP Request to it using HTTP Request Sampler. If you want to send the same request more than once it makes sense to put in under the Loop Controller
Also given the above quote from JMeter documentation if loading the page triggers some AJAX requests to the API - JMeter won't execute these requests automatically, you will need to create a separate HTTP Request sampler per API request. Also real browsers execute AJAX requests in parallel so if there is more than 1 API request - you need to put them under the Parallel Controller

how to test event of a web application with JMeter?

I am using JMeter to test a web application.
I have an HTML stepper with forms that contain dropdowns and buttons (GET, POST requests)
I still cant understand how to test a specific event..
for example lets say I have to select a department from my dropdown and then to pop up a window with a list of subdepartments (checkboxes)..
Where shall I find the HTTPS request urls to use them in the JMeter samplers? From developer tools/Network ?
If selecting a dropdown triggers a HTTP request (i.e. it's some form of AJAX call) you can replicate it using HTTP Request sampler (and most probably HTTP Header Manager) so JMeter will send exactly the same request as the browser does (you might need to perform correlation of the dynamic values)
Basically all you need to do is to configure JMeter to produce the same network footprint as the real browser does so cross-check the request payload from the browser developer tools with what you see in JMeter's View Results Tree listener
Also be aware that it is possible to record the requests generated by browser using JMeter's HTTP(S) Test Script Recorder, see Recording Tests user manual chapter for more details.

Load Testing in Struts2 Application - JMeter

I am trying to do a load test using JMeter for the first Time.
My approach is to test each page one by one.
The main page is like http://localhost:8180/myapp/login.do?actionType=login(I hardcoded the credentials)
I am able to reach this page without any problem.
I created a HTTP request component and able to see the response without any issue.
In the main page there is a button which populates the report, in the browser , the url is like
http://localhost:8180/myapp/mainmenu.do
But when i create a HTTP request it is reaching but shows the security error page in the 'Response
Data' as Due to security reasons, we still recommend you to close this window.
can someone guide me how to test the other pages without these security errors. This is a struts2 Web application.
No matter what technology is being used under the hood of the web application you're testing you should stick to one simple rule:
Well-behaved JMeter test must send exactly the same requests as real browser
It includes:
Same number/sequence/nature of the HTTP Requests
Same HTTP Headers (including Cookies)
any dynamic values need to be properly correlated
Once JMeter will send the same requests as real browser does it should receive the same responses. So just use a 3rd-party sniffer tool like Fiddler or Wireshark to capture the requests originating from browser and JMeter and amend JMeter's configuration until the requests start looking exactly the same. This should resolve your issue.
Solved the issue by adding HTTP Cookie Manger and
set Cookie Policy as Standard
click HTTP Cookie Manager
and click save icon on the top.
Source
https://jmeter.apache.org/usermanual/build-web-test-plan.html#adding_cookie_support
Thanks #Dimitri T and #Roman C for their valuable suggestion.

Much difference in time by single user without tool and single user with jmeter

I am trying to login to an application first with single user and recorded the time using "Page load time" plugin of chrome and then i am trying to login with Jmeter and applying load of Just 1 user but there is much difference in time.
is my approach correct? if yes why there is difference in load time.
Well-behaved JMeter request should give the same timings as browser does.
Make sure you configure your HTTP Request sampler to "Retrieve All Embedded Resources"
Ensure that you have Parallel downloads ticked
Add HTTP Header Manager and configure it to send all the HTTP Headers which browser is sending.
If web application you're trying to load test is built using AJAX technology you will need to add the relevant HTTP Request samplers to mimic asynchronous JavaScript-driven calls as JMeter doesn't execute client-side JavaScript. Once done you can combine requests into one "Login" sequence using Transaction Controller.
See How to make JMeter behave more like a real browser article for more hints on how to properly configure JMeter for web applications testing.

Capture WebDriver requests in Jmeter

One of the services I gonna test using Jmeter has complex authorization mechanism that requires some CS-based steps (JavaScript). So, to set up a session, I have to use WebDriver as Jmeter can't (and actually shouldn't) process JS.
I do it in the following way: at the beginning of each thread I open the resource in real browser (via Jmeter WebDriver plugin), complete authorization, store browser cookies that was set up by server and then use these cookies to generate load using standard Jmeter logic within defined HTTP-session.
This schema works fine and I successfully use it in different load tests.
But now the service I test requires not only cookies but also some important parameters that browser sends in POST as a part of authorization process. To prove that my requests belong to the same session, I should extract some sensitive parameters not from response (it can be easily done) but from request.
I can't find these values stored anywhere in DOM and it seems like these values are generated by JS attached to response page.
So, my question is: is there a way to capture parameters from request sent by WebDriver?
I understand that all requests done by browser initiated in Jmeter are not visible to it. And the only idea I see is to use Jmeter request recorder dynamically:
Open browser window.
Define Jmeter as a proxy for this browser.
Capture requests sent by browser in Jmeter using recorder.
Somehow extract sensitive data from requests.
Use the data to generate load.
Any ideas appreciated. Thanks in advance!
Solved the issue by running local proxy server (BrowserMob Proxy project) using BeanShell sampler. I retarget the WebDriver Sampler to this proxy, perform required actions using browser, then store captured data in HAR format and process it (extract required data from requests). Then just store valuable request parameters in variables (or properties) and use them in a regular way in HTTP sampler to generate load. Hope it can help anyone else in future.

Resources