Integrate Jmeter with Existing selenium JAVA project

41 views
Skip to first unread message

Vemula Mahesh

unread,
Oct 11, 2022, 12:58:05 AM10/11/22
to jmeter-plugins
Hi All,

Can we integrate Jmeter with existing selenium-java project, Instead of using webdriver sampler in Jmeter, Would like to use the existing java code to test load for my application.

Please provide your inputs/thoughts on this.

Thanks,
Mahesh Vemula,


DT

unread,
Oct 11, 2022, 1:25:04 AM10/11/22
to jmeter-plugins
What do you mean by "integrate"?

  1. You can add the project and its dependencies to JMeter Classpath, once done you will be able to call either separate functions or invoke the whole classes/suites via JSR223 Test Elements and Groovy language
  2. If your "selenium-java" project uses JUnit as the underlying xUnit framework - JMeter provides JUnit Request sampler allowing executing separate functions, see How to Run a JUnit Selenium Test article for more information
  3. You can use Taurus tool to run your JMeter and Selenium tests at the same time

Vemula Mahesh

unread,
Oct 11, 2022, 1:43:38 AM10/11/22
to jmeter-plugins
I just want to test the load for my application and used below for project
 - Selenium - Java
- Maven (Build tool)
- testNG framework

Please help me which plugin or external libraries we can use to achieve this

DT

unread,
Oct 11, 2022, 8:04:26 AM10/11/22
to jmeter-plugins
Using Selenium for conducting the load is not the best idea, even official documentation discourages it 

The main reasons are:
  • browsers are very resource intensive and you will need at least 1 CPU core and 2 GB of RAM per browser instance. Multiply it to the number of users you want to simulate and see what kind of hardware you will need
  • you won't be able to collect meaningful metrics, JMeter will give you the time required to run a Java method, that's it, you won't be able to drill down to the level of individual HTTP requests

So a better idea would be converting your Selenium tests into "pure" JMeter, you can:

  1. Start JMeter's HTTP(S) Test Script Recorder
  2. Configure your Selenium tests to use JMeter as the proxy
  3. Run your Selenium tests via JMeter proxy
  4. JMeter will capture HTTP requests and create HTTP Request samplers for them
Reply all
Reply to author
Forward
0 new messages