Test autocomplete in jmeter - jmeter

I have a search form which would open a list when 2 characters are typed. I would like to measure that time it takes to open and load the list in jmeter. How can I do it?

If you look into your "Network" tab of your favourite browser developer tools you will see that each time you type a letter or digit in the search field the browser sends a HTTP request to the backend server and it responds with search suggestions:
So all you need to do is to simulate these requests using JMeter and measure the response time.
You can even record these requests using HTTP(S) Test Script Recorder, Badboy, JMeter Chrome Extension, whatever

There are two things, I would like to quote:
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).
From JMeter Wiki
JMeter does not process Javascript or applets embedded in HTML pages.
JMeter can download the relevant resources (some embedded resources
are downloaded automatically if the correct options are set), but it
does not process the HTML and execute any Javascript functions.
If the page uses Javascript to build up a URL or submit a form, you
can use the Proxy Recording facility to create the necessary sampler.
If this is not possible, then manual inspection of the code may be
needed to determine what the Javascript is doing.
Solution #1
Whenever you type each character, check any service call to the server. This can be captured using browser developer tools > Network tab.
E.g.
If you type iPhone, there will be six service calls to the server. By measuring each call individually, you will be able to understand, how your application behaves under the load.
Again this is a service call, not the UI rendering.
https://example.com?q=i
https://example.com?q=iP
https://example.com?q=iPh
https://example.com?q=iPho
https://example.com?q=iPhon
https://example.com?q=iPhone
Solution #2
By leveraging Selenium WebDriver in your JMeter Test plan, you can measure the end-to-end response time.
Please refer this Blazemeter article and this blog for more details.
Visit JMeter Plugins website and search for Selenium to read more details about Selenium WebDriver.

Related

How to find the Browser rendering time for API in jmeter ,does including retrieve embedded resource gives the overall response time.?

I have to do a performance test for application(It has UI) ,It has API requests ,how to find the browser rendering time for APIs , can we do it with retrieve embedded resource. I am quite new to this ,Can someone please guide me.
Not really, 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).
The only way to measure browser rendering time is using a real browser, if you want to do this along with the existing JMeter performance tests - go for WebDriver Sampler, it provides JMeter integration with Selenium browser automation framework so you will be able to kick off a real browser and measure its rendering time (response time of the WebDriver Sampler will be the time from opening the page till the rendering finishes.
If you need the breakdown - consider using Navigation Timing API

AJAX Defaults Config

Can someone please give me an explanation of AJAX Defaults Config or what is the role of it in Jmeter?
I tried to search for an answer in Google but I can't find a definite definition of it.
As of JMeter 5.1.1 there is no such a thing as AJAX Defaults Config in JMeter Components so most probably you're using some form of JMeter Plugin which is not publicly available. If this is the case you should reach out to the plugin developers/maintainers for the clarification.
For the vanilla JMeter, 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).
Therefore JMeter is not capable of automatically execute AJAX requests because J letter stands for JavaScript
If you need to properly simulate AJAX requests you need to add a separate HTTP Request sampler per AJAX call and put them under Parallel Controller to ensure

Jmeter returing "Loading AppComponent content here " as response data

I am trying to do load testing for a webpage(angular 2), the response data i am getting in tool is "Loading Appcomponent content here ..".
I need the full html to be displayed in response data. Can anyone help?
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 your application content is being loaded via JavaScript calls (the technology is known as AJAX) JMeter won't trigger JavaScript-driven requests as it is not capable of parsing them.
However you can capture the relevant requests using HTTP(S) Test Script Recorder and see the responses, most probably they will come as XML or JSON so you won't see the "real" page, but you will get the data and will be able to measure the requests timings.
Also AJAX requests need to be handled a little bit differently comparing to "normal" sequential HTTP requests as in the majority of cases browsers execute them in parallel, see How to Load Test AJAX/XHR Enabled Sites With JMeter article for more details.

JMeter does not execute the Javascript found in HTML pages? Confused

JMeter User Manual says: JMeter is not a browser. JMeter does not execute the Javascript found in HTML pages.
I wanted to know exact meaning of this statement.
Most perhaps every webpage have javascripts included.
I am taking an example of testing single page (say home page), and as usual this page have number of js, css, images.
During recording, I recorded all embedded resources.
As far my knowledge, before running a test in jmeter, we have following three options
1. Take only top level request (homepage.html) without selecting embedded resources check-box
2. Take top level request (homepage.html) along with selecting embedded resources check-box
3. Keep top level request along with all other components recorded
Which among 3 is the best option to check page load time (I am assuming 1st option, as it tries to replicate close to browser)
and otherwise, if JMeter do not execute javascript, how am I getting response of js file?
JMeter won't execute JavaScript and won't render the page, but it will download the .js file and record and replay any AJAX call which is driven by JavaScript.
So I would suggest going for option 2, but:
tick "Use concurrent pool" and provide number of threads in interval of 3-8
filter "external" resources via "URLs must match" input
add HTTP Cache Manager to ensure that embedded resources are downloaded only once per thread (this is what well-behaved browsers do)
See How to make JMeter behave more like a real browser article for other tips on how to make your load test more realistic
you can get a response of js file with browser automation tools like selenium or testIT Webtester (a fork of selenium)

JMeter and JavaScript

When I make HTTP Request in JMeter I get Response data like "This page uses JavaScript and requires a JavaScript enabled browser." How is it possible to fix this problem.
JMeter is not a browser, and does not interpret the JavaScript in downloaded pages.
From the JMeter wiki:
JMeter does not process Javascript or applets embedded in HTML pages.
JMeter can download the relevant resources (some embedded resources
are downloaded automatically if the correct options are set), but it
does not process the HTML and execute any Javascript functions.
If the page uses Javascript to build up a URL or submit a form, you
can use the Proxy Recording facility to create the necessary sampler.
If this is not possible, then manual inspection of the code may be
needed to determine what the Javascript is doing.
Depending on what you are doing, you could create an execution test using Selenium IDE for Firefox. The test will run in your browser so the JavaScript will also run. Note though that I never used Selenium as a substitute for JMeter and don't know about common features to both the tools.
I suppose you can use the WebDriver plugin to run real browser tests (IE/Firefox/Chrome/Selenium).
There is good documentation here
You can add WebDriver to JMeter test to fully evaluate the page rendering.
Web Driver Sampler automates the execution and collection of
Performance metrics on the Browser (client-side). A large part of
performance testing, up to this point, has been on the server side of
things. However, with the advancement of technology, HTML5, JS and CSS
improvements, more and more logic and behaviour have been pushed down
to the client. This adds to the overall perceived performance of
website/webapp, but this metric is not available in JMeter. Things
that add to the overall browser execution time may include:
Client-side Javascript execution - eg. AJAX, JS templates
CSS transforms - eg. 3D matrix transforms, animations
3rd party plugins - eg. Facebook like, Double click ads, site analytics, etc
All these things add to the overall browser execution time, and this
project aims to measure the time it takes to complete rendering all
this content.
Official guide: https://jmeter-plugins.org/wiki/WebDriverTutorial/
You need to add HTTP Cookie/Cache Manager to your thread in order to solve this.

Resources