how to test event of a web application with JMeter? - 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.

Related

Is it possible to pass Keys.TAB or Keys.Slash using Jmeter through groovy script?

Is it possible to pass Keys.TAB or Keys.Slash using Jmeter HTTP request through a groovy script?
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 if pressing tab or slash triggers a network request to your server - you can mimic it by sending the corresponding HTTP Request via HTTP Request sampler. You can check whether pressing a key generates network activity by looking at "Network" tab of your browser developer tools
If pressing a key doesn't generate a HTTP request - you won't be able to test this scenario using JMeter, you will need a real browser driven by the browser automation framework like Selenium. JMeter can be integrated with Selenium via WebDriver Sampler

Can JMeter record capture requests from a .razor page?

Currently on launching the login page of the application (which is a .razor page) through JMeter after providing all the necessary JMeter configurations, the contents of the page are not displayed in UI.
If the source of the request is .razor and JMeter by itself is not capable of recording it, how can such applications be recorded through JMeter? Is there any work around?
As per Wikipedia ASP.NET Razor article
Razor is an ASP.NET programming syntax used to create dynamic web pages with the C# or VB.NET programming languages.
JMeter doesn't know anything about the backend languages/technologies/patterns/whatever, it just sends HTTP requests, waits for responses and measures time in-between
In case of HTTP and HTTPS protocols you can record the requests using HTTP(S) Test Script Recorder
Looking at Introduction to Razor Pages in ASP.NET Core article it doesn't do any magic so JMeter should capture the requests and be capable of replaying them.
Just pay attention to these "async" calls, real browsers execute AJAX requests in parallel so if this is your case - you might want to put HTTP Request samplers representing async calls under the Parallel Controller
If JMeter is not recording anything the reasons could be in:
JMeter configuration is not correct: check jmeter.log file and your browser console window
The protocol(s) in use are not only HTTP/HTTPS, if there is something like WebSocket under the hood - you won't be able to record it with JMeter, you will have to inspect the requests using your browser developer tools and look for a way of replicating them using suitable JMeter Plugins

Performance test on a webpage which loads data from multiple API's

We have a webpage which will load data from multiple api's as configured by the users. While doing performance test of this page, In HTTP request I have added this page URL and executed the script. To my surprise, the script executed successfully with status as 200 as I dig into more I changed the drop down(In View Results Tree) from Text to HTML(Download Resources) and I don't see any page data in the response. Can someone help me with this. I'm not sure how to proceed with performance testing on this particular page.
As per JMeter project main page:
JMeter is not a browser
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).
My expectation is that your "multiple APIs" are triggered by JavaScript calls using AJAX technology. Given JMeter doesn't evaluate JavaScript it doesn't execute the AJAX requests which are being called by the real browser therefore you don't see the data coming from the APIs.
In order to get the browser-like behaviour you need to send the same requests which real browser sends, you can record them from the real browser using HTTP(S) Test Script Recorder or JMeter Chrome Extension
Also be aware that real browsers execute AJAX requests in parallel, in order to properly simulate browser's network footprint you need to place the HTTP Request samplers representing these API requests under the Parallel Controller

How to conduct performance testing where The service uses meteor js

How to conduct performance testing of my web service? The service displays a page, then the login form in the user's Personal account. It is necessary to enter and display the user's personal account. The service uses meteorjs. To display the personal account is necessary to emulate a browser. jmeter as I understand it is not suitable for this test. He(jmeter) is not able to emulate the browser can't request the js script on the client. Can you recommend tools for such testing? And how conduct ?
Thks
Well-behaved JMeter test can do whatever browser does (from protocol-level perspective). JMeter will not execute client-side JavaScript, neither it will render the response, however if JavaScript generates a HTTP request - JMeter can even record it using HTTP(S) Test Script Recorder (or you can manually create this request by adding relevant HTTP Request sampler)
So the options are:
If your request is ad-hoc (i.e. periodic or on-demand) you can use HTTP Request sampler to mimic it
If your request is asynchronous (AJAX) you can go for one of the techniques described in the How to Load Test AJAX/XHR Enabled Sites With JMeter article or use Parallel Controller plugin
And finally you can use JMeter for kicking off real browser instances using either WebDriver Sampler or JSR223 Sampler

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.

Resources