18
Selenium Project With MAVEN

Maven TestNg frame work (1) (1)

Embed Size (px)

Citation preview

Page 1: Maven TestNg frame work (1) (1)

Selenium Project With MAVEN

Page 2: Maven TestNg frame work (1) (1)

Benefits of Maven over Ant

1. It makes project build process easy.

2. It provides easy and uniform build system.

3. It provides quality project document Information.

4. Managing project dependencies.

5. Provides guild lines for better project management practices.

6. It allows to build project using project object model (POM).

7. It downloads required dependency's jar files automatically from Maven central

repositories.

Page 3: Maven TestNg frame work (1) (1)

Maven Setup (1)

Step 1: To setup Maven, download the maven’s latest version form Apache depending

upon different OS.

Step 2: Unzip the folder and save it on the local disk.

Step 3: Create environment variable for MAVEN_HOME. Follow the below step:

Navigate to System Properties ->Advanced System Setting->Environment Variable -

>System Variable ->New ->Add path of Maven folder

Step 4: Edit path variable and provide the bin folder path.

Page 4: Maven TestNg frame work (1) (1)

Maven Setup (2)

Step 5: Now verify the maven installation using command prompt and don’t forget to

setup JAVA_HOME

Use mvn –version to verify maven version and output comes like below.

Page 5: Maven TestNg frame work (1) (1)

Install Maven IDE in Eclipse

Maven provides IDE to integrate with eclipse. I am using eclipse Juno here. Navigate to

Help->Eclipse Marketplace-> Search maven ->Maven Integration for Eclipse ->INSTAL.

After installation you have to restart eclipse. Then right click on pom.xml and verify all

the options are available like below

Page 6: Maven TestNg frame work (1) (1)
Page 7: Maven TestNg frame work (1) (1)

Create Maven Project For Selenium 2

Step 1: Navigate to File- new-others-Maven-Maven Project-Click Next

Step 2: Check the Create a simple project and click next

Step 3: Provide Group Id and Artefact Id .You can change the version of Jar as per your

wish. Here I am using default name. Click Finish.

Step 4: After finish you will find the project structure is created like below. pom.xml is

created which is used to download all dependencies.

Page 8: Maven TestNg frame work (1) (1)

Conti...In the above project structure we are maintaining all project file in following manner :

➢ Src/main/java -> In this we store all reusable function.

➢ Src/test/java -> In this we store all test cases.

➢ Src/main/resource -> In this we store all external files like :- MS-Excel, CVS

➢ JRE System Lib -> All Java Lib

➢ Maven Dependences -> Store all jar which we mention in POM.xml file

➢ Screen Shots -> This folder generate automatically when test case fail. It store all

Screen Shots in case of Test frailer

➢ Target -> XSLT Report will store in this file .

This folder generate automatically after project execution

➢ Test-output -> Store all TestNG output result

➢ Testng.xml -> This file created by user to run Java file .

Page 9: Maven TestNg frame work (1) (1)

Why Continuous Integration with Jenkins ?Project Management

Detect system development problems earlier Reduce risks of cost, schedule, and budget

Code Quality Measurable and visible code quality Continuous automatic regression unit test

Page 10: Maven TestNg frame work (1) (1)

Workflow View

Page 11: Maven TestNg frame work (1) (1)

Jenkins Setup (1)

Step1.Go to http://jenkins-ci.org/ and download jenkin.war file

Step2: Keep This Jenkins. War File where your project is lying/Where you have

workspace for Example: C: Users\Workspaces\Project Name

Step3: Open Command prompt and go till project home directory and append "Java -jar

Jenkins. War and run it.

Page 12: Maven TestNg frame work (1) (1)

Jenkins Setup (2)

Now Jenkins is fully up.

Step4: Open your Browser and give local host url :> localhost:8080.

Step5: Now click on Configure System

Step6: Now set The jdk path.

Step7: Add the path of your jdk. Now click on Add jdk

Step8: Now Create a New Job. To run your Test Case. We have to create a New Job

Click on New Item

Page 13: Maven TestNg frame work (1) (1)

Jenkins Setup (3)

Step9: Now Add the Path of your Project...In directory..

Step10:Click on Add build step Click on Build Now

Page 14: Maven TestNg frame work (1) (1)

XSLT Reports (1)

A custom report style, which gives the entire overview of the execution status, pass %,

fail %, and complete list of the test cases executed.

Case I :- When Complete Test Scenario Pass

Page 15: Maven TestNg frame work (1) (1)

XSLT Reports (2)

Case II :- When Complete Test Scenario Fail

Page 16: Maven TestNg frame work (1) (1)

XSLT Reports (3)

Details description about each Test Case

Page 17: Maven TestNg frame work (1) (1)

XSLT Reports (4)

Details description about each Test Steps

Page 18: Maven TestNg frame work (1) (1)