Running Jmeter with ChromeDriver
By: Slav Kurochkin
Here is the task I been trying to accomplish for a couple days, generate user activity through UI. The goal is to have multiple users interacting with the system and performing various simple tasks. For example login, search, logout etc.
For this purposes I made decision to integrate Selenium tests with JMeter, so we can launch multiple browser instances simultaniously.
There is two ways you could accomplish it:
- Using JUnit Request Sampler
- Using WebDriver Sampler
Since I want interact more with JMeter and to be able provide different type of variables directly form JMeter WebDriver plugin been selected over JUnit.
I assume you already have JMeter installed, then you would need to download
Once download finished, extract zip archive somewhere temporary. Then open the folder where your JMeter located, navigate to ..\apache-jmeter-2.13\lib and paste all .jar files from WebDriver plugin ..\lib. Open ..\apache-jmeter-2.13\lib\ext and paste .jar file from WebDriver plugin ..\lib\ext.
After all files been moved to appropriate places, launch JMeter and verify plugin installed:
Right click on a Test Plan => Add => Threads => Config Element => and make verify is presented Chrome Driver Config.
Now lets set the project:
1. Add Thread Group
2. Then Chrome Driver Config (right click on Thread Group => Add => Config Element => Chrome Driver Config)
You would need to specify location of chromedriver.exe (btw download it, if you haven't yet), then open Chrome Driver Config and switch to Chrome tab and add path, it would be something like:
3. Add WebDriver Sampler (right click on Thread Group => Add => Sampler => WebDriver Sampler)
And add some test code:
Run the tests!
You might have an error message like that on first run
2015/08/04 13:41:37 ERROR - jmeter.threads.JMeterThread: Test failed! java.lang.NoClassDefFoundError: Could not initialize class org.apache.http.impl.conn.ManagedHttpClientConnectionFactory
Then problem is duplicate files in your lib folder, so if problem appear open JMeter lib folder and make sure there is no duplicates.
Here is original stackoverflow solution.
For more information check out Blazemeter posts
1. The WebDriver Sampler: Your Top 10 Questions Answered
2. Using Selenium with JMeter's WebDriver Sampler