You are on page 1of 16

Open2Test Test Automation Framework for Selenium Web Driver - Quick Start Guide

Version 1.0
Apr 2013

DISCLAIMER Verbatim copying and distribution of this entire article royalty, in any medium, provided this notice is preserved. are permitted worldwide, without

Table of Contents

TABLE OF CONTENTS
1 2 3 PURPOSE..................................................... 3 ENVIRONMENT SETUP .............................................. 4 FRAMEWORK
AT

GLANCE ............................................ 5
IN

3. PROJECT SETUP 4 5 USAGE


OF

ECLIPSE ........................................ 7

KEYWORDS ............................................. 14
FOR A

TEST RESULTS

KEYWORD-DRIVEN SCRIPT .......................... 15

Open2Test.org

Page ii

Open2Test Test Automation Framework for Selenium Web Driver Quick Start Guide

PURPOSE
This document explains the support settings and how to get started with keyword-driven scripting using Selenium WebDriver.

www.Open2Test.org

Page 3

Open2Test Test Automation Framework for Selenium Web Driver Quick Start Guide

Environment Setup
The following jar files are required to run the Open2Test Selenium Webdriver Framework. jexcelapi_2_6_12 or higher junit-4.9 or higher selenium-server-standalone-2.7.0 or higher

www.Open2Test.org

Page 4

Open2Test Test Automation Framework for Selenium Web Driver Quick Start Guide

Framework at Glance
Input Files: a. Selenium Utility Excel: The TestSuite, TestScript, Object Repository and Report location should be mentioned in Selenium_Utility excel. Folder

File\Folder Name
Test Suite Test Script Object Repository Summary Report Screen Shot Report Detailed Report

Location
D:/path/Test_Suite1.xls D:/path/ D:/path/TestData/ObjectRepository.xls D:/path/Test Reports/ D:/path/Test Reports/ScreenShot_Report/ D:/path/Test Reports/Detailed_Report/

Note: The selenium utility excel file should be placed in D:\Selenium_Utility.xls.If you wish to place the utility file in some other location, you must update the path in the ReadUtilFile() function in the framework. b. Object Repository Excel: Collect the properties of Object_Repository.xls like below objects and define it in

Object Name Welcome to Open2Test.org logo.jpg Home About Us Tech Docs News Roadmap Comment Support Contact Us banner.jpg Learn More Learn More_1 Name emailID selectframework Agreement

Object Type Page Image Link Link Link Link Link Link Link Link Image Link Link Textbox Textbox ComboBox Textbox

Parent 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

ObjectPath name= xpath=/html[1]/body[1]/div[1]/div[1]/img[1] link=Home link=About Us link=Tech Docs link=News link=Roadmap link=Comment link=Support link=Contact Us xpath=/html[1]/body[1]/div[1]/div[2]/div[1]/img[1] link=Learn More link=Learn More id=name id=emailID xpath=//select id=Agreement

www.Open2Test.org

Page 5

Open2Test Test Automation Framework for Selenium Web Driver Quick Start Guide
Terms & Conditions Input new.gif More news Sitemap Privacy Policy Link Textbox Image Link Link Link 1 1 1 1 1 1 link=Terms & Conditions id=submit xpath=/html[1]/body[1]/div[1]/div[2]/div[2]/div[2]/p[1]/img[1] link=More news link=Sitemap link=Privacy Policy

c. Test suite Excel: Mention the test scripts in the Test suite excel in the order you wish to execute them.

Run
r r r r r

Test Scripts
Mantis_Create Project Mantis_Report Issue Mantis_View Issue and Delete Project Mantis_Fail Call Tariff Addition and Amendment

d. Test Script Excel Write the keywords for the test script like below
Run r r r r r r Keyword LaunchApp importdata loop perform perform check call r r perform perform perform r r r perform screencapture Endloop ComboBox;selectframework Textbox;Agreement Link;Terms & Conditions Button;input select:Web Framework (V2) for Selenium click click click Textbox;name Textbox;emailID Textbox;emailID ObjectDetails www.open2test.org D:\001_D_Files\path\TestData\TestData.xls 3 set:dt_username set:dt_email enabled:true Sheet1 Action Action2 Comments

www.Open2Test.org

Page 6

Open2Test Test Automation Framework for Selenium Web Driver Quick Start Guide

3. Project Setup in Eclipse


Create a Java project in Eclipse

www.Open2Test.org

Page 7

Open2Test Test Automation Framework for Selenium Web Driver Quick Start Guide

Note: Please note that JavaSE-1.7 has to be used

www.Open2Test.org

Page 8

Open2Test Test Automation Framework for Selenium Web Driver Quick Start Guide

Add the required jar files to the library:

www.Open2Test.org

Page 9

Open2Test Test Automation Framework for Selenium Web Driver Quick Start Guide

www.Open2Test.org

Page 10

Open2Test Test Automation Framework for Selenium Web Driver Quick Start Guide

Remove the contents of the new class and Copy the framework into the new class file

www.Open2Test.org

Page 11

Open2Test Test Automation Framework for Selenium Web Driver Quick Start Guide

www.Open2Test.org

Page 12

Open2Test Test Automation Framework for Selenium Web Driver Quick Start Guide

www.Open2Test.org

Page 13

Open2Test Test Automation Framework for Selenium Web Driver Quick Start Guide

Usage of Keywords
The keywords for the test scenario should be entered in the Sheet1 of the Microsoft Excel placed in the Test Scripts folder. The syntax for the keywords can be referred from Selenium Keywords Reference Dictionary Document.

www.Open2Test.org

Page 14

Open2Test Test Automation Framework for Selenium Web Driver Quick Start Guide

Test Results for a Keyword-Driven Script


Test execution results can be viewed and analyzed as soon as the run session ends. To access the test results, go to the Test_Reports folder customized using the test automation framework. Two folders will be available: one showing the summary report for test suite execution, and anoter folder called Detailed_Report that displays the detailed stepwise test results for each test script. A screenshot will be available for the failure scripts under ScreenShot_Report.

www.Open2Test.org

Page 15

Open2Test Test Automation Framework for Selenium Web Driver Quick Start Guide

COPYRIGHT This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.

www.Open2Test.org

Page 16