Selenium, Cucumber, JUnit, TestNG dependencies for Selenium project.

Author: neptune | 02nd-Apr-2023
🏷️ #Selenium #Testing

If you are here then you definitely know what is pom.xml file, if not then POM stands for Page Object Model. 




When we create or convert the Selenium project into the Maven project the pom.xml file is added to the project root directory. POM maintains the dependencies of  Selenium, Cucumber, JUnit, TestNG, etc. 

If we need to update, add, or delete dependencies then we can easily do that with the help of a pom.xml file.




All you need to do is copy and paste the below dependencies in the pom.xml file in between the dependencies tag :


<dependencies>

// add selenium, cucumber any other dependencies

</dependencies>




1. Selenium Dependencies

For creating project on selenium we need to add below dependencies in our pom.xml file.

      <!-- These are the selenium-webdriver dependencies -->

<dependency>

<groupId>org.seleniumhq.selenium</groupId>

<artifactId>selenium-java</artifactId>

    <version>3.5.2</version>

</dependency>

<dependency>

<groupId>org.seleniumhq.selenium</groupId>

<artifactId>selenium-server</artifactId>

<version>3.5.2</version>

</dependency>

<dependency>

<groupId>org.seleniumhq.selenium</groupId>

<artifactId>selenium-chrome-driver</artifactId>

<version>3.5.2</version>

</dependency>

<dependency>

<groupId>org.seleniumhq.selenium</groupId>

<artifactId>selenium-remote-driver</artifactId>

<version>3.5.2</version>

</dependency>

    <!-- selenium-webdriver dependencies end -->




2. Cucumber Dependencies

If we want to use cucumber in our project then add the below dependencies in pom.xml.


<!-- These are the cucumber dependencies β†’

<dependency>

<groupId>info.cukes</groupId>

<artifactId>cucumber-java</artifactId>

<version>1.2.5</version>

</dependency>


  <!-- cucumber dependencies end -->





3. Cucumber-JUnit Dependencies

To include JUnit in our project we need to include below JUnit dependencies in the project.


     <!-- These are the cucumber-junit dependencies -->

<dependency>

<groupId>info.cukes</groupId>

<artifactId>cucumber-junit</artifactId>

<version>1.2.5</version>

</dependency>

      <!-- cucumber-junit dependencies end β†’


    <!-- These are the junit dependencies β†’

<dependency>

<groupId>junit</groupId>

<artifactId>junit</artifactId>

<version>4.12</version>

</dependency>

         <!-- These are the junit dependencies -->





4.Cucumber-TestNG Dependencies

To include TestNG in our project we need to include below TestNG dependencies in the project.


<!-- These are the Cucumber-TestNG dependencies -->

<dependency>

<groupId>info.cukes</groupId>

<artifactId>cucumber-testng</artifactId>

<version>1.2.3</version>

</dependency>

<!-- Cucumber-TestNG dependencies end -->





Above all dependencies are basic dependencies for Selenium Maven Project using TestNG as a reporting tool. You can add more dependencies along with the above dependencies.




Complete pom.xml file


Check how to create Selenium project in eclipse here.

Thanks for Reading !!!



πŸ‘‰ Read More
Automate Ticket Booking in SpiceJet from Delhi to Bengaluru using Selenium and Cucumber.
Roadmap To Become Test Automation Engineer
5 Selenium Project Ideas & for Beginners in Automation Testing
How to use wait commands in Selenium WebDriver in Java ?
Top 50+ Selenium Interviews Questions 2023 based on Years of Experience
Different types of software testing ?
Top 10 Selenium Interview Questions with answers (2021).
Mostly asked Cucumber interview questions in selenium automation interviews.
How to create Selenium Cucumber Project in Eclipse.
Getting Started with Cypress: Advantages, Setup, and First Test Guide
Explore more Blogs...