Setting up Selenium Project Using Maven


 
We will use Eclipse IDE and Maven for building the Selenium WebDriver test framework.
  1. Launch the Eclipse IDE.
  2. Create a new project by selecting [File -> New -> Other] from Eclipse Main Menu.
  3. On the New dialog, select [Maven -> Maven Project] as shown in the following screenshot:

  1. Click on [Next], the New Maven Project dialog will be displayed. Select the [Create a simple project (skip archetype selection)] check-box and set everything to default and click on the Next button as shown in the following screenshot: 

  1. On the New Maven Project dialog box, enter base package name (like com.myproject.app) in Group Id and project name (like myproject) in Artifact Id textboxes. You can also add a name and description but it is optional. Set everything to default and click on the [Finish] button as shown in the following screenshot:


  1. Eclipse will create the myproject project with a structure (in Package Explorer) similar to the one shown in the following screenshot:
7.       
           7. The JRE version might change based on the Java version installed on your machine. 
              Right-click on JRE System Library [J2SE-1.5] and select the Properties option from the 
              menu.       
  1. Select pom.xml from Package Explorer. This will open the pom.xml file in the editor area with the Overview tab open. Select the pom.xml tab instead.
  2. Add the WebDriver and TestNG dependencies highlighted in the following code snippet, to pom.xml in the node:
http://maven.apache.org/xsd/maven-4.0.0.xsd">
         4.0.0
         com.myproject.app
         myproject
         0.0.1-SNAPSHOT
    
        org.seleniumhq.selenium
        selenium-server
        2.42.2
   
  
                  org.testng
                  testng
                  6.8.8
   test
  
 
 
   
     
        src/test/resources
       
          **/*.java
       
     
     
        src/test/java
       
          **/*.java
       
     
   
   
   
     
        maven-compiler-plugin
        3.1
       
          1.6
          1.6
       
     
   
    
/project>
  1. Right click on pom.xml from Package Explorer & Select [Run As -> Maven Install]

Comments

Popular posts from this blog

Testing Webservice with SoapUI Having Windows Authentication

How to Re-run Failed Scenarios in Cucumber