Keyword Driven Framework is a functional automation testing framework that divides test cases into four different parts in order to separate coding from test cases and test steps for better automation. Keyword driven testing framework divides the test cases as test steps, objects of test steps, actions on test steps and data for test objects for better understanding.
What is Keyword Driven Testing? Keyword Driven Testing is a scripting technique that uses data files to contain the keywords related to the application being tested. These keywords describe the set of actions that is required to perform a specific step.
Keyword-driven testing is an application-independent automation framework. This framework requires the development of data tables and keywords, independent of the test automation tool used to execute them and the test script code that "drives" the application-under-test and the data. Keyword-driven tests look very similar to manual test cases. In a keyword-driven test, the functionality of the application-under-test is documented in a table as well as in step-by-step instructions for each test.
The process begins with a test designer writing a test case -- like the one above. The test designer doesn't have to know how to program; he could be a business analyst. A programming-savvy tool smith (QTP Test Engineer) implements a framework that provides keywords like "WindowClickButton," "WindowEnterTextValue" and "VerifyWindowTitle." The framework might make use of a separate interface driver, such as a graphical user interface (GUI)test tool.
The wonderful thing about test scripts at this level of abstraction is that they can be independent of both the interface driver and the application's interface. Though the sample script above uses terms suggesting a GUI interface, the interface could be an application user interface (GUI)or anything else.
The real benefit is the improved maintainability of the test scripts. The keyword approach follows in a longstanding tradition of modularizing the test automation so that it's easier to recover from user interface changes in the system under test.
A keyword-driven test consists of high and low-level keywords, including the keyword arguments, which is composed to describe the action of a test case. It is also called table-driven testing or action word based testing.
In Keyword Driven Testing, you first identify a set of keywords and then associate an action (or function) related to these keywords. Here, every testing action like opening or closing of browser, mouse click, keystrokes, etc. is described by a keyword such as openbrowser, click, Typtext and so on.
Why do Keyword Driven Testing
Common components handled by standard library
Using this approach tests can be written in a more abstract manner
High degree of reusability
The detail of the script is hidden from the users
Users don't have to use the scripting languages
The test is concise, maintainable and flexible
Advantages
It is best suited for novice or a non-technical tester.
Enables writing tests in a more abstract manner using this approach.
Keyword driven testing allows automation to be started earlier in the SDLC even before a stable build is delivered for testing.
There is a high degree of reusability.
Disadvantages
Initial investment in developing the keywords and its related functionalities might take longer.
It might act as a restriction to the technically abled testers.
The folder structure of the Framework is as shown below −
Explanation of the folder structure −
Master Driver Script − The Script that drives the entire execution. It performs prerequisite and initial settings that are required for the execution.
Library Files − The Associated Functions that forms the Function Library.
Data Table − The Test Data that is required for the Execution.
Object Repository − The Objects and its properties that enable QTP to recognize the objects seamlessly.
Execution Logs − The Folder contains the execution log file with user functions and function execution history.
Excel Sheet to Store the Keywords: This is the only extra component that you will find in a Keyword Driven Framework. Once you have identified the required keywords, you can store them in an excel sheet. You would need to write some code that will first open this excel sheet and copy the keywords.
Framework Architecture
Driver script workflow
Driver Excel sheet Columns in the driver table and how they are used for script execution Open the excel Driver file specified by the user and located in the following path “\\Automation\TestDataSheets\”: