testsigma
Topics
left-mobile-bg

What is Keyword Driven Testing | Frameworks & How to Perform

February 15, 2024Priyanka
right-mobile-bg
What is Keyword Driven Testing Frameworks & How to Perform
imageimage

Start automating your tests 5X Faster in Simple English with Testsigma

Try for free

An automation framework plays a crucial role in implementing test automation in an organization. A robust framework helps to yield the desired benefits. 

While designing an automation framework you need to consider design patterns, strategy, and type of framework. There are different types of frameworks such as linear automation frameworks, modular-based testing frameworks, data-driven frameworks, and keyword-driven frameworks, etc. 

Keyword-driven framework is best suitable for non-technical users as there is a high degree of re-usability. Let’s understand the keyword-driven framework in detail.

What is a Keyword Driven Framework?

Keyword-driven framework is a type of functional test automation framework that separates the test design and development. It uses predefined keywords to perform a set of actions. A keyword can optionally contain the set of parameters that need to be passed, which in turn triggers the specific action on the Application Under Test(AUT).

What is Keyword Driven Testing?

Keyword-driven testing is action-driven testing that uses the collection of keywords to define the action and reuse them within the same tests. A keyword contains one or more user actions on a test object. The keywords are used to describe the test steps which makes it easier to automate each test case. In layman’s terminology, keyword-driven testing is the process of testing the application using the keyword-driven methodology.

Why Perform Keyword Driven Testing? 

Keyword-driven testing has multiple advantages such as test cases being defined in simple keywords, once the framework is set up it is easy to use for any non-technical users. Furthermore, maintaining keyword-driven testing is comparatively easier.

Below are some of the reasons why to use keyword-driven testing.

  • Common components are handled using common libraries which increases the reusability
  • The complex code is hidden in the background, the testers need not bother about implementation.
  • It encourages low code testing, as end users do not need to know the programming languages.
  • Test steps are concise and accurate, there is no ambiguity
  • It is easy to maintain, as common components are organized in one place

Tools Used for Keyword-Driven Testing

Most of the automation tools support the keyword-driven. The keyword-driven framework is architectural design practice rather than the feature of tools. Below are some of the tools which are popular for Keyword Driven Testing

Selenium

Selenium is open open-source test automation tool, widely used for web testing applications. It supports many platforms such as Windows, macOS, and Linux. Selenium supports cross-browser testing such as Firefox, Chrome, Edge, and Safari. As the Selenium framework can be designed using any programming language like Java, Javascript, C#, Ruby, or Python, it makes the automation engineer’s life easy.

Selenium tool supports keyword-driven framework to a large extent. It can be achieved by separating keywords for a common set of functionalities and commands. The actions are written in external files generally using the Excel file, the user just needs to specify the keyword to perform the specific actions. Keyword-driven framework standards can be defined in the table format, which consists of the test cases, associated actions, and related keywords.

Playwright

Playwright is a new tool in the market, It is open source and maintained by Microsoft. The Playwright supports different types of frameworks. Like Selenium, Playwright can also used for the keyword-driven framework. It supports various browsers such as Firefox, Chromium, Edge, Chrome, and Webkit Safari. Playwright tests are comparatively faster than the Selenium as it uses the WebSocket protocol for communication. Playwright doesn’t use third-party drivers like Chrome Driver, Gecko Driver, etc, It directly injects the command into the browser.

Playwright keyword-driven framework design involves writing the Action classes and implementing the Excel data readers. The keywords are defined and stored in an external file like Excel. You might also be required to implement certain listeners, and utilities based on the need. If you combine the Page object model with keyword-driven testing it makes the automation framework more reusable.

Ranorex

Ranorex is a commercial tool for keyword-driven test automation. As it is a commercial tool, it provides certain benefits to design keyword-driven framework. Ranorex comes with a rich IDE and many keyword driven supporting features and hence reduces the learning curve. Once you identify the keywords, you need to implement them.  Then, you can start creating the test cases using those keywords. Ranorex also helps you to create reusable scripts which reduces the maintenance time.

Ranorex provides the shared repository for UI objects and you may not have to use the excel files to store the keywords as these features are readily available in Ranorex. It is easy to integrate the keyword driven testing using the Ranorex however, all these come with a commercial license.

Robot Framework

The Robot Framework is an open-source, Python-based framework. It has the powerful capability to perform both acceptance testing and Robotic Process Automation(RPA). You can easily design the keyword-driven framework using the Robot Framework. It uses Python language which helps to write code in more readable format, and it makes novice users’ jobs easier. This is a very Generic framework hence, you can customize and extend this framework easily.

Advantages And Disadvantages of Keyword Driven Testing Framework

Like any other framework type keyword-driven framework also has some pros and cons. Below is the list of advantages and disadvantages.

Advantages of Keyword Driven Framework

  • It helps to develop tests without programming knowledge
  • A high degree of reusability can be achieved using the keyword-driven framework
  • Easy to maintain the tests
  • The data, keywords, and functions are independent; it helps to modify the data without touching the internal code
  • As it abstracts the internal code, the test cases are more readable.

Disavantages of Keyword Driven Framework

  • Though keyword-driven frameworks are easy to use, the creation of keyword-driven frameworks is complicated, and it requires a high degree of technical expertise
  • Redundant keywords may cause framework chaos over time
  • It requires good amount of planning and strategy during the initial phase
  • The keyword and its implementation need to be maintained on time

Components of a Keyword Driven Framework

Keyword-driven framework separates the data, keyword, and implementation. It uses the external files to store the data. The functions are implemented in the programming language file, and the execution engine combines everything to achieve the result.

Below are the components of keyword-driven framework.

Keyword Libary

This is an external file, generally an Excel file, which holds the Set of keywords mentioned in sequence for each functionality.

Object repository

As you are aware, the test automation tool performs actions on the webpage using the web elements or unique identifiers the Object repository stores.

Common Libraries

It is also called a function library, which contains the callable actions implemented. These libraries are designed by implementing automation tool-specific commands.

Data Inputs

The data is stored separately to increase the reusability of the framework. The data input contains the set of data that will be read while performing the actions.

Test script

The test script uses the data input, and common libraries and makes the actual test case

Execution Script

The execution script is responsible for executing the test cases by reading the environment-specific data, and keywords and performing the actions on the browser.

Phases of Keyword Driven Testing

The Keyword driven testing can be divided into  5 different phases as mentioned below

Identify low- and high-level keywords

Break the application into functions and identify the high-level or low-level keywords

Implement the keywords

Once you identify the keywords, you need to write the implementation. For example, the keyword can be “click on button”; you need to implement them to perform the action.

Create test cases

The test cases are written to verify the functionality hence, it contain one or more keywords to be written. The create test case phase requires combining all relevant keywords to get the expected result

Create a driver script

This phase contains, identifying the reusable functions, environment-specific libraries, and data. Once you identify them, you need to implement them accordingly.

Execute automation test scripts

Execute the automation script with necessary data and store the output in a required format.

How to Perform Keyword-Driven Testing?

The keyword-driven testing is generally used for automation testing, though it is possible to use it for manual testing; unless it is required it will not be used. Once your keyword-driven testing framework is ready, it is simple to perform the keyword-driven test automation.

  • Identify the test cases to automate
  • Identify the keywords for the test cases
  • Combine the keywords to automate them
  • Execute the test case
  • Record the output

Commonly Used Keyword-Driven Framework Structures

The Keyword-Driven Framework can be implemented in different ways; below are the two most common approaches.

Functionality Based Keyword Driven Framework

In this type of framework, the keywords are tied to functionality rather than the actions. For example, if you have a login function, you can define the keyword called “login”, internally it performs by typing the username and password and clicking on submit.

Action Based Keyword Driven Framework

The keywords are tied to actions; each keyword is designed to perform a single action. In this type, rather than providing the functional-based keyword, testers provide the action-based keyword. For example, to perform a login functionality tester has to provide a username, type a password, and click on submit keywords.

Limitations of Keyword-Driven Testing

  • Requires a dedicated technical resource team to continuously implement the new actions and maintain the code.
  • Testers don’t have the internal architecture knowledge, so it is difficult to identify false failures.
  • The complex application requires thousands of keywords, and their implementation adds costs to the organization
  • It requires proper planning in the initial phase, which is difficult to achieve in the real world.
  • It may not go well with agile teams, especially if there is a separate framework team that manages the implementation.

Sample Test Cases of Keyword-Driven Testing

Let’s take an example of a test case and understand how we can automate them using the Keyword Driven Framework. (keywords are in bold)

Functionality: Login to Testsigma

Keyword Driven Testcase: 

Navigate to “https://app.testsigma.com/

Type username

Type password

Click on the Submit button

Verify HomePage is displayed

Functionality: Verify Testsigma Products

Keyword Driven Testcase:

Navigate to “https://testsigma.com/

Click on the Product menu

Verify Web application testing sub-menu is displayed

Verify Mobile app testing sub-menu is displayed

Verify API testing sub-menu is displayed

Conclusion

An automation framework can be designed using different approaches. While designing the automation framework, first you need to decide on the approach and architecture that you will use. 

Keyword driven development (KDD) is one such approach that helps to swiftly increase the automation test coverage. The KDD follows a low code approach which helps novice and nontechnical users to write the script in plain English language. 

The main limitation of keyword Driven Framework is it requires a lot of effort to design the framework and requires highly skilled resources. Thankfully, many tools like Testsigma provide the ready framework, you can simply sign up and start using that. Testsigma follows a low-code and no-code approach, testers can simply write the test scripts in plain English language. Furthermore, Testsigma doesn’t require you to implement any actions, everything is available readily. This can help to reduce the cost to the organization by lowering the upskilling and maintenance costs.



Frequently Asked Questions (FAQs) 

What is a data-driven framework as compared to keyword driven?

Keyword-driven frameworks and Data-driven frameworks both are the most popular test automation framework designs. The main difference is keyword driven framework doesn’t require programming language expertise, but data data-driven framework requires coding knowledge. Similarly, the Keyword driven framework stores the keywords in an external file, and data driven testing framework stores the input data in an external file. 

 What is keyword-driven testing in Selenium?

Selenium can be used to design the keyword-driven testing framework. In keyword-driven framework, selenium commands are used for internal implementation; the tester needs to provide only specific keywords to automate the test cases.

imageimage
Subscribe to get all our latest blogs,
updates delivered directly to your inbox.

RELATED BLOGS


Grey box testing: Techniques, Process & Example

KIRUTHIKA DEVARAJ
8 MIN READ
TESTING DISCUSSIONS

How to Write Test Cases for Notepad? [Sample Test Cases]

SHANIKA WICKRAMASINGHE
13 MIN READ
TESTING DISCUSSIONS

A Beginner’s Guide to Autonomous Testing

PRICILLA BILAVENDRAN
12 MIN READ
TESTING DISCUSSIONS