My company has a bunch of automated test cases for our regression sweeps made using Selenium. We would like to add load to some of them but can't figure out a viable way to do it because the data can be dynamic. Any help will be greatly appreciated. Please let me know if you need more information.
JMeter is made for generating load, and WebDriver is made for testing user interfaces. Neither is great for doing the other.
You can configure JMeter to talk to WebDriver -- see this tutorial -- but you cannot just drop your existing WebDriver test into JMeter; you have to rewrite it in a way that only works with JMeter.
Going the other direction, some have tried using multiple instances of WebDriver-operated browsers to generate load, but that doesn't scale.
I recommend scripting something that launches JMeter, then runs your WebDriver tests in a different process, then stops JMeter afterward.
If for some reason you need to stick to Selenium, first of all, have you heard about Selenium Grid?
If yes and it doesn't fit your needs - here are the options:
Depending on what programming language (Selenium client library) and xUnit framework you use for your tests you can go for following:
If your tests written using Java and JUnit - you can re-use them in JMeter via JUnit Request Sampler. Make sure you add all the dependency libraries to JMeter classpath. See How to Use JUnit With JMeter guide for details.
There is WebDriver Sampler which provides some level of Selenium integration.
- You can invoke your tests via OS Process Sampler as well, but in that case JMeter metrics will be flaky.