Maven Build Automation Tool Selenium WebDriver

Maven Build Automation Tool Selenium WebDriver

Ques-What is Maven and Why to use in Selenium?
Ans- Maven is a build automation tool used primarily for Java projects. The word maven means “accumulator of knowledge” .
Maven addresses two aspects of building software:
First, it describes how software is built,
Second, it describes its dependencies.
Setting up the Maven Project in Eclipse
Precondition- Maven should be installed in Eclipse -Install Maven
Step1- Open Eclipse and Click on New >Project
Maven Project

 Step 2-Select Maven > Maven Project >Next
Maven Project

 Step 3-   Check the mention checkbox then Click Next button. 

Step 4- Enter Group id (as per your requirement ) and Artifact ID (as per your requirement ) > Next

In the Group Id, enter Selenium.maven. In artifact Id, enter the project name, for example,Selenium.maven.demo. Click on Finish to create the project.

Artifact ID – project name.

GroupID -> com.maven(package name)

Step 5- Click on pom.xml and you will get the source code of pom.xml

Step 6-To integrate Maven with Selenium then we need to add dependency with Selenium 

 so navigate to

Step 8-  Selenium already provided maven dependency so simply copy the below dependency

Step 9- Open pom.xml and add <dependencies> tag and paste above copy code inside <dependencies> tag

Note – Each tag should be closed like <dependencies> —-</dependencies>

After paste your pom.xml will look like

Step 10- Lets integrate the TestNG also in Maven project and Repeat the same steps as we did for Selenium

Note- Once you will update pom.xml then inside your project you will get maven dependency 

Write testcases in Maven Project

Step 1- Inside project select src>test>java and right click then create a class

Step 2- Specify package and class name and finish

Step 3- Create the below testng program.

Note- Its demo program you can write your test cases

3.Right click on project, click on ‘Run As’ and then click on ‘Maven Test’

Executing the testng.xml from pom:Add the below lines to the pom.xml

Leave a Reply

Your email address will not be published. Required fields are marked *