Run selenium test using testng & maven in eclipse

In this post, we will see how to create a maven project in eclipse and run selenium java tests using testNG.

 

Why to use Maven

Maven helps to easily update libraries (jar files) required to run selenium tests and also easy to maintain the jar files.

Note : If you want to manually add the jar files to your project, then follow here

 

Prerequisites

 

Eclipse – https://www.eclipse.org/downloads/packages/

Chose the eclipse for java developers version which comes with inbuilt maven and testNG, if not then you can install maven and testng from eclipse marketplace (Help > marketplace)

 

pom.xml

Get the pom.xml from here [Updated with latest version]

You can find the all version of libraries from here

 

testng.xml

 

Maven project

Create a maven project in eclipse, follow here for more details

SampleSelTest.java

 

Run the testng.xml file to execute selenium java script.

Content posted is based on learning or working experience,
Share the post with others if find useful,
Any queries?, leave comments or discuss on our facebook:qavalidation.com, Thanks!

Leave a Reply

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