The keyword driven framework in Selenium is a functional automation Testing framework known as table-driven testing or action word-based testing. The basic working of the keyword driven framework is dividing the test case into four different parts. The first one is the test step; the second is an object of the test step; the third is the test object’s action, and the fourth is data for a test object.
The above categorization could be done and maintained with the help of an Excel spreadsheet:
Test step: It is a very small representation of the test step of the description of the test object’s action.
Test object: It is the webpage object or element name like username and password.
Action: What is the name of the action that will perform on any object such as a click, open browser, input, etc.
Test data: Data could be any value required by the object for performing any action like username value or username field.
The main idea behind the keyword driven approach is separating coding from the test case and test step. It helps a technical person help understand automation very well. With a manual tester, you can write automation scripts, and it doesn’t mean that an automation test is not required.
Still, in any keyword driven project, the hardcore technical coder is required to set up the framework and work on regular changes and updates of background automation code. But for example, of automation team could have to manual tester and an automation coder.
Why keyword driven testing?
Keyword Driven Testing is a scripting technology used to contain the keywords associated with the testing program. These keywords represent the number of steps needed to take a particular move. Keyword-driven testing in Selenium evaluation includes the high and low level of the keywords that characterize a test case’s behavior, including keyword arguments. Table-driven or action word-based testing is sometimes named.
Keyword driven testing is performed because of the following reasons in software engineering:
- The standard library handles common components.
- Using this approach, tests could be written more abstractly.
- High usability degree.
- Details of the script are hidden from the users.
- Users don’t have to use scripting languages.
- The test is concise, maintainable, and flexible.
How to perform keyword driven testing?
Keywords testing could be performed in both ways manually as well as automatically. But generally, it is used with automated testing. The main objective behind automating keyword-based testing are:
- It helps in reducing the maintenance cost.
- It avoids duplicated specifications.
- Greater reuse of function scripting.
- Better testing support and portability.
- Achieving more testing with less or the same effort.
Using the keyword driven testing approach, you can also create a simple, functional test in earlier stages of development by testing the application piece by piece. The easiest way for composing keyword driven tests is by recording them. After recording, the test could be modified and customized as per the requirement.
Every keyword should be linked with at least one command, test script for a function that will implement the actions related to that keyword. When test cases are executed, keywords will be interpreted by a test library that is called a test automation framework.
Some major activities involved in keywords testing are:
Step 1: Identifying low-level as well as high-level keywords.
Step 2: Implementing the executable keywords.
Step 3: Creating test cases.
Step 4: Creating the driver scripts.
Step 5: Executing automation test scripts.
Below provided is a list of some common components that will be required for achieving the task:
- Excel sheet: This sheet keeps most of the data keyword driven, required for tests like test cases, test steps, test objects, and actions.
- Object repository: Property file for storing the HTML elements properties of the web application. You can link this property file with the objects in the test.
- Keyword function library: In a keyword driven framework, fine play a crucial role as it stores the working of the actions so that each action could be callable from this file.
- Datasheet: Excel file for storing the data value required by the object for performing some action on it.
- Execution engine: The test is the only test script we have in a keyword framework, and it contains all the code for driving the test from Excel sheet, function library, and properties file.
The picture below illustrates the generic flow of the Driven Keyword Framework:
You can see from the above that a generic flow is anything like this in the Keyword Driven Framework
- The Execution Engine begins the evaluation and connects to a bundle of test cases.
- Once test cases are selected, connected test steps are sequentially followed.
- Also, Test steps are linked to page objects, actions, and test data
- The running engine receives all the necessary information for the testing process, the program links, and steps.
Benefits of keyword-driven testing
Below are the benefits of keyword-driven testing:
- Less technological expertise: Manual testers or non-technical testers can quickly write the automatic test scripts once the frame has been set up.
- Quick to Follow: The test scripts are easy to read and understand as they are maintained in Excel sheets, and no code is exposed. The keywords & acts very closely mimic the more easily written and maintained manual test cases.
- Early Start: Before you apply, you should start constructing Keyword Driven test cases, as it is easy to set up an object repository later. Keyword data tables representing the corresponding manual test protocol may be generated using information obtained from requirements or other documents.
- Re usability of component: Reusability can be further enhanced with Keyword Driven modularization.
- Reusability of code: As in the keyword driven framework, only one execution engine is available, excessive code reusability is promoted.
A scripting method using data files contains the keywords specific to the training framework is a keyword driven examination. Tests are consistent with any automation software on the market presence in the market without programming experience tests.