Tuesday, 19 July 2011

Example - Selenium 2 with Maven Tool

Aim:
How to work on Selenium 2 with Maven tool.

Difficulty Level: High

Questions?

  1. What is Maven tool?

Exercise Execution Time: more details coming soon

Steps

  1. First download Maven from following URL: http://maven.apache.org/download.html.
  2. Unzip the downloaded folder into ‘Program Files’ directory (not mandatory).
  3. Set M2 is “C:\Program Files\apache-maven-3.0\bin” and M2_HOME is “C:\Program Files\apache-maven-3.0” as environmental variable into your system.
  4. Set the path “C:\Program Files\apache-maven-3.0\bin” into System variables.
  5. Now Create a Selenium Project directory.
  6. Put the “pom.xml” file into Project Directory.
  7. Create some Scripts and put into Project Directory.
  8. Again create a directory into Project directory and put into “testng.xml” file.
  9. Now run the ‘mvn install’ command into command prompt and it gets executed successfully.




Pom.XML - POM stands for "Project Object Model". It is an XML representation of a Maven project held in a file named pom.xml. The following is the project descriptor used to describe the Maven project:
<?xml version="1.0"?>
<project>
  <pomVersion>3</pomVersion>
  <name>jakarta-turbine-maven</name>
  <id>maven</id>
  <currentVersion>1.0-b4-dev</currentVersion>
  <organization>
    <name>Apache Software Foundation</name>
    <url>http://jakarta.apache.org/</url>
  </organization>
  <inceptionYear>2001</inceptionYear>
  <package>org.apache.maven</package>

  <shortDescription>Java Project Management Tools</shortDescription>

  <!-- Gump integration -->
  <gumpRepositoryId>jakarta</gumpRepositoryId>

  <description>
    Maven is a project management and project comprehension
    tool. Maven is based on the concept of a project object
    model: builds, documentation creation, site publication,
    and distribution publication are all controlled from the
    project object model. Maven also provides tools to
    create source metrics, change logs based directly on
    source repository, and source cross-references.
  </description>

  <url>http://jakarta.apache.org/turbine/maven/</url>
  <issueTrackingUrl>
    http://nagoya.apache.org/scarab/servlet/scarab/
  </issueTrackingUrl>
  <siteAddress>jakarta.apache.org</siteAddress>
  <siteDirectory>
    /www/jakarta.apache.org/turbine/maven/
  </siteDirectory>
  <distributionDirectory>
    /www/jakarta.apache.org/builds/jakarta-turbine-maven/
  </distributionDirectory>

  <repository>
    <connection>
      scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:jakarta-turbine-maven
    </connection>
    <url>
      http://cvs.apache.org/viewcvs/jakarta-turbine-maven/
    </url>
  </repository>

  <versions>
    <version>
      <id>b3</id>
      <name>1.0-b3</name>
      <tag>MAVEN_1_0_B3</tag>
    </version>
    <version>
      <id>b4</id>
      <name>1.0-b4</name>
      <tag>HEAD</tag>
    </version>
  </versions>

 .
.
</project>


Helpful Video:

4 comments:

  1. I have used "pre class" tags with the uploaded codes but I don't know why I don't see the codes without downloading option.

    ReplyDelete
  2. Hi Vipin,

    Can you please update this page with all the files that need to be created as it seems that there are a few things missing.

    Thanks.

    ReplyDelete
  3. The example does not look complete - please see the video compared to the text in the example are incorrect

    ReplyDelete