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:
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 |
|
Test Script |
|
Object Repository |
|
Summary Report |
|
Screen shot Report |
|
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 |
---|---|---|---|
|
Textbox |
1 |
|
|
Textbox |
1 |
|
|
Button |
1 |
|
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 |
|
r |
|
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 |
|
| |
r |
|
|
|
r |
|
|
|
r |
|
| |
r |
|
|
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.
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.