How record multiple website Action - jmeter

How record multiple website Action
I have a one master company and have a multiple slave company so, I want to record all action for all website for one test plan

You can record multiple URLs in the same test plan. Assume that you want to record below three websites.
http://example1.com
http://example2.com
http://example3.com
In JMeter
Create three loop controllers (or any controllers of your choice) in your test plan as shown below.
Before you start recording http://example1.com, go to Recording Controller and select the Example1 controller as shown below.
Start your recording.
Once you are done with the recording of http://example1.com, go back to JMeter and change the controller to Example 2 and repeat the above steps.
Ditto for Example 3 as well.
In this way, you can multiple URLs within the same test plan.
Alternate Method
Another simpler way is to use Blazemeter Chrome Addon to record JMeter tests. Install the addon in Chrome browser and simply record your flow across multiple URLs. While exporting you can check which URLs to include/exclude.

Related

"URL pattern to include" not working in JMeter

Tried to capture request having only specific url e.g "www.yahoo.com" in URL but JMeter capturing all the requests from google, mozilla etc
Tried with patterm :
.*www.yahoo.com.*
But not working.
I cannot reproduce described behaviour using latest JMeter 5.1
According to the HTTP(S) Test Script Recorder documentation
Patterns to Include Regular expressions that are matched against the full URL that is sampled. Allows filtering of requests that are recorded. All requests pass through, but only those that meet the requirements of the Include/Exclude fields are recorded. If both Include and Exclude are left empty, then everything is recorded (which can result in dozens of samples recorded for each page, as images, stylesheets, etc. are recorded).
It means that you will see all the requests in the View Results Tree listener, but only those which match your regular expression will be stored under the Recording Controller
Also be aware that www.yahoo.com and yahoo.com are different servers, you might want to reconsider your test scenario.
Check out JMeter Proxy Step by Step guide for more information on recording in JMeter

How to sort/get desired URLs properly in WorkBench and Run it in TestPlan of JMeter?

I have to record and run Jmeter test using WorkBench so that I have recorded using Proxy[See the image].
Lists all the URLs
I know I can sort/get the urls by using 'URL Patterns to Include' option in HTTP(S) Test Script Recorder. When recording it lists out all the URLs including .gif, .png, .ico etc.
URL Patterns to Include
I have two doubts to clear.
When recording what is the criteria to give in 'URL Patterns to Include' - to record desired URLs only. (Desired URLs I meant is for example, if I am recording a website developed in PhP, I need all PhP links only. ie, home.com/index.php, home.com/contact.php, home.com/about.php). Now it records all the URLs where I cannot see the desired links. How to get .php or main link URLs(we see in browser URL)?
Regarding running a test in Test Plan contains the URLs that I have cut-paste from WorkBench(recorded using Proxy), do we need to add all the recorded URLs including .gif, .png, .ico etc or just add the specific URLs(say home.com/about.php) only? If I run using only the specific URLs, whether the result will be correct as we excluded other URLs like .gif, .png, .css etc ?
You don't need to record these .gif, .ico, etc. files separately as this is not how real browsers work.
Real browsers do main request to the HTTP endpoint followed by concurrent download of so called embedded resources: images, scripts, styles, etc. In order to make your JMeter test to behave more like a real browser you need to:
Exclude these requests from recording. Click "Add suggested excludes" button in the HTTP(S) Test Script Recorder (or even better re-record your test scenario using JMeter Recording Template feature)
You can create a recording test plan by selecting File -> Templates -> Recording -> Create from JMeter's main menu.
When it comes to test execution add HTTP Request Defaults to your Test Plan, switch to the "Advanced" tab and tick Retrieve All Embedded Resources and Parallel Downloads boxes
If there are images, banners, whatever coming from external servers you can filter them as well via URL(s) must match box in form of Perl-5 compatible regular expression.
See Web Testing with JMeter: How To Properly Handle Embedded Resources in HTML Responses article for more information on dealing with embedded resources in JMeter tests.

Test autocomplete in 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.

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)

performance testing of a html website using jmeter

Can i do performance testing of a website which is developed only in html. It does not contain any back end. it is made only of html but it contains many pages.
Yes, you can.
For that purpose you need Jmeter HTTP(S) Test Script Recorder. With help of it you can record your interaction with web-site and then filter out some objects (images for example) which you don't need to record/capture.
As a result you'll have a Jmeter script which you can then modify and extend.
You can also read a good tutorial about using Test Script Recorder here.

Resources