Keyword-Driven framework

A Keyword-Driven test is a kind of functional automation testing, where keywords are used instead of scripts. Since all the required Selenium functions and operations are prewritten in an external user-defined driver, basic knowledge of the framework's workflow is more than enough to learn and maintain tests. Furthermore, a fully developed Keyword-Driven framework reduces a tester's scripting effort. Let's take a look at Open2Test, which is purely a Keyword-Driven framework that supports Selenium WebDriver too. This framework handles the Binary Excel sheet through JExcel API.

The Open2Test components, namely Selenium_Utility, ObjectRepository, TestSuite, and Test_Script are the source files used to perform Keyword-Driven tests. See the following screenshot to get an idea about the framework structure:

Keyword-Driven framework

These components are available in the form of Excel sheets, where Utility Excel stores all the location paths of the object repository, test suite, test script, and report folder. The following table represents Selenium Utility Excel of the Open2Test framework:

File Folder Name

Path Location

Test Suite

C:/.../Test_Suite.xls

Test Script

C:/.../Test_Script.xls

Object Repository

C:/.../Object_Repository.xls

Summary Report

C:/.../Report/

Screen shot Report

C:/.../Screen_shot/

Detailed Report

C:/.../Detailed_Report/

Let's see how to use this approach in an example with a simple Google search. Create an object repository Excel sheet, where the elements can be stored with an object name. These objects are always reusable and maintained in a separate Excel file. The following is an object repository Excel content table that contains elements of a Google page:

Object name

Object type

Parent

Object path

clear_search

Textbox

1

name=q

google_search

Textbox

1

name=q

submit_search

Button

1

id=sblsbb

As we know, a test suite is a collection of test cases; it can have any number of test cases. The following table is a test-suite Excel content table with a couple of test scripts:

Run

Test scripts

r

Test_Script.xls

r

Test_Script2.xls

The test case sheet contains keywords to perform Selenium WebDriver functions, such as click, clear, submit, and so on. Here, the keywords, such as launchapp, perform, check, condition, storevalue, and loop are predefined in the Open2Test framework that give you full control over the application under test. The following test case (Test_Script.xls) Excel content table contains a clean Google search workflow:

Run

Keyword

Object details

Action

r

launchapp

http://www.google.com

 

r

Perform

Textbox;clear_search

Clear

r

Perform

Textbox;google_search

set:Selenium Essentials

r

Perform

Button;submit_search

 

r

Wait

5000

 

An Open2Test keyword is launchapp, which allows users to access the Google page URL. The Perform keyword is used to execute Selenium WebDriver functions. Meanwhile, there are keywords that assert or verify an element. Remember that this framework has limitations and is not yet fully stable. Certainly, the Open2Test framework can be modified with additional functions.

Note

To acquire the Open2Test driver, refer to https://bit.ly/1yz5F0L.

Creating a Keyword-Driven framework consumes more time and scripting skills; however, it is highly efficient and reliable. Moreover, it reduces the scripting effort and improves the reusability of test scripts.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.132.99