Performance Testing using Jmeter and Selenium WebDriver

Refer to the below Links for Practise
Complete JAVA QUIZ
Selenium Advanced Quiz
50 Real Time Interview Questions
Selenium Quiz
REST API QUIZ

JMETER
The Apache JMeter™ application is open source software, a 100% pure Java application designed to load test functional behavior and measure performance. It was originally designed for testing Web Applications but has since expanded to other test functions.

Apache JMeter features include:
Ability to load and performance test many different applications/server/protocol types:
• Web – HTTP, HTTPS (Java, NodeJS, PHP, ASP.NET, …)
• SOAP / REST Webservices
• FTP
• Database via JDBC
• LDAP
• Message-oriented middleware (MOM) via JMS
• Mail – SMTP(S), POP3(S) and IMAP(S)
• Native commands or shell scripts
• TCP
• Java Objects

Scenario:
Execute the Selenium Scripts in JMETER and verify the average response time taken in the execution of Selenium Scripts.



1. Download the Apache JMETER zip file from this link -> https://jmeter.apache.org/download_jmeter.cgi
Example: Download apache-jmeter-x.0.zip file.
2. Unzip the file and verify the contents of the JMETER.

Apache JMeter Directory Structure


3. Download the jmeter-plugins-webdriver from this link https://jmeter-plugins.org/?search=jpgc-webdriver and extract the contents and copy in the JMETER/lib folder.
Selenium-Jmeter Jar

Selenium-Jmeter Jar


Example: Download jpgc-webdriver-2.3.zip file.
4. Download the Java Native Access jars and JNA Platform jars and extract the files and copy in the JMETER/lib folder as shown below:

Java Native Access[JNA] allows you to call directly into native functions using natural Java method invocation. The Java call looks just like the call does in native code. Most calls require no special handling or configuration.
5. Open JMeter bat available under JMeter/bin folder.
• Right Click on Test Plan->Create Thread Group.
• Right Click on Thread Group->Select Sampler->WebDriver Sampler
• Right Click on Thread Group-> Select Config Element->Firefox Driver Config.
• Right Click on Thread Group->Listener->View Results in Table.

Sampler->Samplers tell JMeter to send requests to a server and wait for a response.
Config->Configuration elements can be used to set up defaults and variables for later use by samplers.
Listeners->A listener is a component that shows the results of the samples.
6. Copy the Jmeter Script in the WebDriver Sampler as shown below:

7. Execute the Jmeter Script and verify the Results in the View Results Table Listener for the Sample Time captured for executing the Selenium Script.

Jmeter Sampler Time in (ms)

Response Time in (ms)

Leave a Reply

Your email address will not be published. Required fields are marked *