Steps To Integrate Selenium Test Case With Apache JMeter
In this article, learn how to integrate selenium test scrips with JMeter for performance testing.
Join the DZone community and get the full member experience.Join For Free
Integrating selenium test cases with JMeter can be done using the following concepts.
- Using JUnit Sampler
- Using WebDriver Sampler
- Required jars/plugins before we integrate selenium test scripts with Apache JMeter.
- Download the Plugin Manager Jar File from the website here.
- Put the File in the lib/ext directory in JMeter
- Then Restart JMeter
1. Using JUnit Sampler
Below are the steps along with a screenshot to perform pre-requisites for JUnit Sampler.
Step 1: Click “Options” and then “Plugins Manager" from Apache JMeter
Step 2: Download jpgc-webdriver 2.3 from the website here.
Step 3: Copy the
lib/ext file and put the file in the
lib/ext directory in JMeter folder
Step 4: Restart JMeter.
Refer Below Steps To Perform or Create JUnit Sampler Request
Step 1: Go to Thread Group ---> click on Add ---> click on Sampler --->select JUnit Request as below shown in the screenshot:
The JUnit Request can be viewed as displayed below:
Step 2: Considered we have already a JUnit test case created in Eclipse, to Export JUnit Test case ---> Right Click the JUnit Test case (Created in Eclipse IDE ) ---> Click on the “Export” option as shown below:
Step 3: Select “Jar File” under JAVA folder in Eclipse ---> Click “Next”
Step 4: Now, Select the JUnit Test case ---> Give the path with (.jar) extension ---> Click “Finish”
Step 5: Now, Open Apache JMeter and click on Run ---> JUnit Request.
To view the results ---> Go to “Thread Group” ---> Add ---> Listener ---> View Results Tree
The description of the Result can be viewed in “Sampler result” as displayed:
2. Using WebDriver Sampler
Below are the steps to integrate the web driver sampler with Apache JMeter.
Step 1: Right Click Thread Group ---> Add ---> Sampler ---> jp@gc - WebDriver Sampler
The “jp@gc - WebDriver Sampler” can be viewed as displayed
Step 2: Type the code given in the Screenshot below
Step 3: Save and Run the Test case ---> View The Results in View Results Tree
This is how we integrate either JUnit Sampler or WebDriver Sampler with Apache JMeter to do performance testing.
Opinions expressed by DZone contributors are their own.