With the improvements in technology more and more of the business logic gets executed on the client side and it’s not easy to get a clear picture of the perceivable performance by using pure JMeter tests only.
To extend these measurements JMeter-Webdriver plugin in JMeter can be handy to run WebDriver tests using actual browsers and to get client side execution statistics.

In the following section I will demonstrate how to configure and run a simple WebDriver test in JMeter.

First you have to download the plugin from the JMeter plugin page http://jmeter-plugins.org/downloads/all/ and then copy the library files into JMeter installation folder.

From now on when you start up JMeter you should have the extra Config Element and Sampler components visible on the tool list and they are ready to use

2016-04-12_sampler
Add a thread group into a new Test Plan, then add a Firefox config and add a WebDriver sampler into the new thread group. You can also add a Listener to check the test results after a test run.

2016-04-12_results

For this example the default configurations of the Firefox config is enough and we can directly select the WebDriver Sampler. On the sampler you can choose the script language, for case of simplicity we should stick to Javascript.

Copy the code from below into the script sections:

WDS.sampleResult.sampleStart()
WDS.browser.get('http://google.com')

if(WDS.browser.getTitle() != 'Google') {
    WDS.sampleResult.setSuccessful(false)
    WDS.sampleResult.setResponseMessage('Page title is not Google!')
}

WDS.sampleResult.sampleEnd()

In our example test case we will navigate to the main Google page and check its title.

Click the play button to start. If you followed the simple instructions the browser pops up and the test will pass.
2016-04-12_samplerAdded
For the WebDriver plugin details go to http://jmeter-plugins.org/wiki/WebDriverSampler/

WeDoQA we offer both manual and automated testing and mostly focus on Selenium related services. We provide commercial Selenium support as well as have our in house Selenium framework to quickly start up new projects without a need for a long setup time.
We constantly improve our Selenium framework. Currently it supports:

1. Java based application
2. Ant or Maven build and dependency management
3. TestNG or JUnit test frameworks
4. Parallel test run<>
5. Custom made and well tested wait methods
6. IE, Edge, Chrome and Firefox support
7. Customizable report generation
8. Screenshots and logging
9. UI verification against database or API
10. TestRail integration
11. Load testing using Amazon AWS, Jmeter and Selenium

Feel free to contact us for a quote or to discuss any projects you might have. www.wedoqa.com

Similar Posts from the author:

6 thoughts to “Running webdriver code in JMeter

  • Andrey

    This is a really nice approach. Usually, frontend business logic is very complicated and it’s hard to come up with the load testing plan. Exercising frontend pages through browser using JMeter is a solution for this problem.

  • Andrey

    This is a really nice approach. Usually, frontend business logic is very complicated and it’s hard to come up with the load testing plan. Exercising frontend pages through browser using JMeter is a solution for this problem.

  • shalini

    I have selenium automation scripts ready with functional flow now i want to integrate those scripts with JMeter for load testing. Is it possible? if yes means how to integrate both.

  • shalini

    I have selenium automation scripts ready with functional flow now i want to integrate those scripts with JMeter for load testing. Is it possible? if yes means how to integrate both.

Comments are closed.