If we have to test any web application using Selenium everytime we need to download jar files from http://docs.seleniumhq.org/download/ and configure into eclipse.If we need test reports or any jar files we first download and add into in our Project.But maven has solved this problem for us By using Maven we just have to add dependecies in Pom.xml files and it will downloaded all the Jar files from Server.
What is Maven
Maven – a build automation tool which is distributed under Apache Software Foundation.
What is pom.xml file.
Its the core of maven.If we need any jar files in our projects we just need to add dependencies of those jar files in Pom.xml.When maven runs it will download all the jar files from apache server.
For reference you can use this http://docs.seleniumhq.org/download/maven.jsp
If you need any jar file like poi jar or Selenium jar files files you just need to add dependencies in POM.XML File.It will download all the jars from server.
This is pom.xml File.If you will use Maven You will get this in your project.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com..framework.datadriven</groupId>
<artifactId>DemoProject</artifactId>
<version>1</version>
<packaging>jar</packaging>
<name>Datadrivenframework</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.1.1</version>
<scope>test</scope>
</dependency>
<!-- Selenium -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.42.2</version>
</dependency>
<!-- POI -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.6</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.6</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>3.6</version>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>2.3.0</version>
</dependency>
<!-- Log4J -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
<!-- JavaMail -->
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles-->
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<!-- TestNG-xslt related configuration. -->
<plugin>
<groupId>org.reportyng</groupId>
<artifactId>reporty-ng</artifactId>
<version>1.2</version>
<configuration>
<!-- Output directory for the testng xslt report -->
<outputdir>/target/testng-xslt-report</outputdir>
<sorttestcaselinks>true</sorttestcaselinks>
<testdetailsfilter>FAIL,SKIP,PASS,CONF,BY_CLASS</testdetailsfilter>
<showruntimetotals>true</showruntimetotals>
</configuration>
</plugin>
</plugins>
</reporting>
</project>
This pom.xml will download automatically when maven
What is Maven
Maven – a build automation tool which is distributed under Apache Software Foundation.
What is pom.xml file.
Its the core of maven.If we need any jar files in our projects we just need to add dependencies of those jar files in Pom.xml.When maven runs it will download all the jar files from apache server.
For reference you can use this http://docs.seleniumhq.org/download/maven.jsp
If you need any jar file like poi jar or Selenium jar files files you just need to add dependencies in POM.XML File.It will download all the jars from server.
This is pom.xml File.If you will use Maven You will get this in your project.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com..framework.datadriven</groupId>
<artifactId>DemoProject</artifactId>
<version>1</version>
<packaging>jar</packaging>
<name>Datadrivenframework</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.1.1</version>
<scope>test</scope>
</dependency>
<!-- Selenium -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.42.2</version>
</dependency>
<!-- POI -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.6</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.6</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>3.6</version>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>2.3.0</version>
</dependency>
<!-- Log4J -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
<!-- JavaMail -->
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles-->
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<!-- TestNG-xslt related configuration. -->
<plugin>
<groupId>org.reportyng</groupId>
<artifactId>reporty-ng</artifactId>
<version>1.2</version>
<configuration>
<!-- Output directory for the testng xslt report -->
<outputdir>/target/testng-xslt-report</outputdir>
<sorttestcaselinks>true</sorttestcaselinks>
<testdetailsfilter>FAIL,SKIP,PASS,CONF,BY_CLASS</testdetailsfilter>
<showruntimetotals>true</showruntimetotals>
</configuration>
</plugin>
</plugins>
</reporting>
</project>
This pom.xml will download automatically when maven
How to download Maven
Go to this link
Step1:
You will Get a Zip folder.Extract this Zip file into Your suitable Drive.
Note:This configuration is very simple as you have configure java and ant into Your System.
Step2:
After extracting you will get this folder.
Step3:Set up maven in Environment.Go to Environment Variable.
Step4: Click on Environment Variables.
Step5: Click on New
Step6: In variablename Textbox: Write M2_HOME.
In variable Value Give the path of Your Apache maven upto Bin Folder.
Step7:Go to Path in System Variable.Click on Edit
Step8:Set maven path as Write ;%M2_HOME%\bin
Step9:Open cmd prompt.
Step10: Type in cmd Prompt --version and Press enter.
Step1:
You will Get a Zip folder.Extract this Zip file into Your suitable Drive.
Note:This configuration is very simple as you have configure java and ant into Your System.
Step2:
After extracting you will get this folder.
Step3:Set up maven in Environment.Go to Environment Variable.
Step4: Click on Environment Variables.
Step5: Click on New
Step6: In variablename Textbox: Write M2_HOME.
In variable Value Give the path of Your Apache maven upto Bin Folder.
Step7:Go to Path in System Variable.Click on Edit
Step8:Set maven path as Write ;%M2_HOME%\bin
Step9:Open cmd prompt.
Step10: Type in cmd Prompt --version and Press enter.
Step11: Output.Maven is Installed Successfully.
How to work with Maven will Tell You in The Next Post.















