Integrating Selenium WebDriver with JMeter
Apache JMeter and Selenium WebDriver are two popular tools, former used for performance load testing and later used for functional or regression testing of web applications. While JMeter gives the response time, Selenium WebDriver can give actual page rendering time when integrated with JMeter. We will discuss benefits of integrating Selenium WebDriver with JMeter.
How Load Test in JMeter works:
- Jmeter sends http requests to target server
- Server responds
- Jmeter gathers data and calculate statistical information
- Presents the result in visualization reports
How Functional Test in Selenium WebDriver works:
- Selenium WebDriver Sends the request over JSON to Browser Driver through HTTP protocol
- Browser Driver communicate with real browser
- Real Browser will perform the operation and response will go back in HTTP response
Advantage of using Selenium WebDriver with JMeter
- While standalone JMeter tool can give response time of the request response scenario of web application, Selenium with JMeter can give real rendering time of the web page as selenium will enable to execute client side code like Javascript and load DOM in real browser.
- By integrating Selenium with JMeter, we will be able to use Navigation Timing API's for reliable and accurate collection of page loading events.
- Selenium Test can be automatically converted into JMeter test using Test Script Recorder.
- Allows you to re-use selenium functional tests for load testing.
How to integrate Selenium WebDriver in JMeter
Using Plugin Manager in JMeter, one can install WebDriver Plugin in JMeter
- One needs to add, config element 'HTTP Cookie Manager', respective 'WebDriver Config' and sampler 'WebDriver Sampler' under Thread Group.
- There are different 'WebDriver config' elements plugin for different browsers viz. Chrome, FireFox, Internet Explorer etc. Will have to set appropriate driver path in the respective config element.
- Add appropriate listener like 'View Results Tree' under the thread group.
- Selenium Script can be written in 'WebDriver Sampler' section.
- Detailed steps of integrating Selenium WebDriver with JMeter.
Conclusion:
Although JMeter allows you to capture response time of application, integrating selenium scripts with JMeter can get you user experienced load time of application.
Post a Comment