Enroll in Selenium Training

Its is been a long time since I am running away from this topics as frankly speaking I never thought the integration with build tool would any help to Automation Life cycle. I can not think of a scenario where the build is happening and testers are not around On top of it there are good chances that your automation script will fail due to any number of reasons during the build process and I am sure that the developers would not be able to fix that for you. So the conclusion is that when the testers are present during the build time then why don't just wait for the build & deployment and start the automation suite manually.

People who are interested in Maven for Selenium, let me just warn them that only using Maven would not have any significance in Selenium life. This tool has to integrate with Jenkins as well to give any benefits to Selenium Automation. You may face N number of issues with installing and in setting up Maven & Jenkins which would be difficult to resolve, as we as Test Engineers are not very technical. Please be calm and read out every line and word of this tutorial to understand it else you would end up with lots of frustration.

What is Maven?

Maven is a build tool and it performs a task just like Ant which is again a different build Tool. It is a software project management tool that provides a new concept of project object model (POM). Maven allows the developer to automate the process of the creation of the initial folder structure, performing the compilation and testing and the packaging and deployment of the final product. It cuts down the good number of steps in the build process and it makes it one-step process to do a build.

Why Maven is Used?

As I said above it cuts down the tasks in build process. To summarize, Maven simplifies and standardizes the project build process. It handles compilation, distribution, documentation, team collaboration and other tasks seamlessly. Maven increases reusability and takes care of most of build-related tasks. It helps in bypassing my steps like adding jars to the project library, building reports, executing Junits test cases, creating Jar, War Ear files for the project deployment and many more. A very significant aspect of Maven is the use of repositories to manage jar files.

Few Glossaries around Maven

Maven Local Repository

This is the place where Maven stores all the project jars files or libraries or dependencies. By default the folder name is '.m2' and by default the location in windows 7 is 'Libraries\Documents.m2'.

Maven Central Repository

Maven central repository is the default location 'http://mvnrepository.com/' for Maven to download all the project dependency libraries. For any library required in the project, Maven first looks into the .m2 folder of Local Repository, if it does not find the required library then it looks in Central Repository and downloads the library into the local repository.

Dependency Keyword

Dependencies are the libraries, which are required by the project. For example Log4j jars, Apache Poi jars, Selenium Jars, etc. Dependencies are mentioned in the Maven pom.xml like this:

  	<dependency>
  		<groupId>org.seleniumhq.selenium</groupId>
  		<artifactId>selenium-java</artifactId>
  		<version>2.43.1</version>
  	</dependency>

Surefire Plugin

The Surefire Plugin is used during the test phase of the build lifecycle to execute the unit tests of an application. It generates reports in 2 different file formats like plain text file, XML files, and HTML files as well. Even if you are using TestNG or Junits framework for reporting, this plugin is a must to use, as it helps Maven to identify tests.

Maven POM

POM is a Project Object Model XML file that contains information about the project and configuration details used by Maven to build the project. It contains default values for most projects. Some of the configurations that can be specified in the POM are the project dependencies, the plugins or goals that can be executed, the build profiles, and so on.

How to Install Maven in Eclipse IDE
How to Install Maven in Eclipse IDE
Next Article
Lakshay Sharma
I’M LAKSHAY SHARMA AND I’M A FULL-STACK TEST AUTOMATION ENGINEER. Have passed 16 years playing with automation in mammoth projects like O2 (UK), Sprint (US), TD Bank (CA), Canadian Tire (CA), NHS (UK) & ASOS(UK). Currently, I am working with RABO Bank as a Chapter Lead QA. I am passionate about designing Automation Frameworks that follow OOPS concepts and Design patterns.
Reviewers
Virender Singh's Photo
Virender Singh

Similar Articles

Feedback