Skip to content Skip to navigation
Check Our New Demo Website!

Maven Tutorials

Execute selenium webdriver testng.xml using Maven

We can execute our tests using maven Surefire plug-in. This plug-in is used during the test phase of software build lifecycle to execute tests. To configure Surefile Plug-in, we need to add the snippet as below in pom.xml file. And also we need to add TestNG dependency to the pom.xml file.

To get started with TestNG, we need to include the following dependency in our project configuration file Pom.xml

Basic example program using WebDriver Java Maven

Let us create a very basic example step by step to use Webdriver, Maven with Java.

Why we should use maven is because of many reasons : -

1. We need maven to get all our dependencies automatically, which also allows users to reuse same jars across multiple projects.

2. Each and every engineers in a project use the same jar dependencies due to the centralized POM.

3. It provides the complete structure with naming conventions which is easy to locate and execute tests.

4. We can automate the complete build procedure etc etc

Create a Simple Maven Project in Eclipse

In the earlier tutorials, we have seen how to install maven in eclipse. Now we will go ahead and create a simple maven project. Before proceeding, we assume you already installed Maven.

As mentioned earlier MAVEN helps us in creating the project structure, managing and downloading the dependencies. We need to define the required dependencies in pom.xml. We will look more in detail. (By default maven adds few dependencies specific to project structures and that will be based on the archetype that we choose).

First let us create a simple maven project


Install Maven in Eclipse

You can install maven as a plug-in for Eclipse. Using Eclipse Market Place or By using Install new software option.

First let us try installing using an easy way 'Eclipse Market Place'.

After you click on Eclipse market place under help menu, we need to search for maven. It will show you many results with maven. Please select the Maven based on your eclipse version like Maven Integration for Eclipse and m2e connector etc (Kepler/Luna etc).


Creating Project Structure with Maven

As mentioned earlier MAVEN helps us in creating the project structure, managing and downloading the dependencies(MAVEN adds few default dependencies specific to project structures).

How does MAVEN know all this – meaning how is it able to differentiate between project structures, how does it know which project structure needs which dependency?


What is MAVEN?

This tutorial is a brief introduction to MAVEN, we’ll look at what MAVEN is and we’ll also learn how to set up MAVEN on development environment.

So what is MAVEN?

To answer that question in a single sentence is not possible because MAVEN is a lot of things put into one. Most and common usages of MAVEN are…

1) Build tool (Similar to ANT in this case for example)
2) Project management tool is one other role played by MAVEN. It helps to generate reports, it helps in dependency management.

Subscribe to RSS - Maven Tutorials