How to Do Load Testing With Jmeter and Selenium
Intro
In a previous tip I demonstrated a way to accomplish a simple load test with a Selenium script and an HTTP library. While it works, it's only useful for rudimentary test cases.
For more involved test cases and more powerful load generation, we're going to need something stronger.
A Solution
JMeter is the defacto open source load testing solution that is used in industry. The hardest part of using it is authoring the test cases (e.g., in the JMeter GUI). Thankfully we can sidestep that by repurposing our Selenium tests into initial JMeter scripts. To do this we'll need a proxy server, the HTTP Archive (HAR) each test generates, and a HAR to JMeter XML (JMX) converter.
When we're done, we'll have working JMeter test cases that we can modify and run (either from the GUI or the command-line).
Let's dig in with an example.
About The Author
Dave Haeffner is the original writer of Elemental Selenium -- a free, once weekly Selenium tip newsletter that's read by thousands of testing professionals. He also created and maintains the-internet (an open-source web app that's perfect for writing automated tests against).
Dave has helped numerous companies successfully implement automated acceptance testing; including The Motley Fool, ManTech International, Sittercity, and Animoto. He is also an active member of the Selenium project and has spoken at numerous conferences and meetups around the world about automated acceptance testing.