Git is the most widely used modern version control system in the world today, which allows multiple persons to safely work on the same project without hampering other team members. As a part of a team using Git, You and your team members will clone working copy of a local repository from Git server. You/team will add and commit the test scripts that are developed locally and push your changes to the Git.
Say suppose we have a scenario where we need to execute only a set of TestNG.xml files from the wide range of available xml suite files. It is like we want to run only the specific tests that are in testng.xml files and some times we may again need to kick off other testng.xml files. But for sure we don't want to execute all the suites and wait for them to complete the execution.
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
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
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
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).
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?
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.
So what is MAVEN?
Maven is a build / project management tool, based on the concept of a project object model (POM) contains information of project and configuration information for the maven to build the project such as dependencies, build directory, source directory, test source directory, plugin, goals etc.
Step 1: System Requirements
Check if java installed on your machine.
From Command prompt, please enter "java -version" which will display the Java version installed in your local machine.