OVERVIEW
Keyword driven testing is one of such software testing methodologies that involves describing test cases using a predefined set of keywords. It separates test development from your test design. It is a collection of executable keywords that simulate a user's actions, such as logging in, clicking a mouse, typing a name, etc.
The rising demand for Agile and DevOps has transformed traditional testing methods, thereby helping teams to avoid the hassle of slow software release cycles and increasing overall product release velocity. With the help of keyword-driven testing, you can use the same keywords repeatedly within a single test, which results in more excellent test coverage.
Keyword driven testing, also known as table-driven testing or action word-based testing, is a type of automated functional testing that separates test case design from test development. It is a collection of keywords that you can reuse within the same tests. In simple terms, a keyword is the combination of a user's action on a test object. Using keywords to describe test steps makes test cases easier to understand, automate and maintain. You can use Keyword-driven testing for both manual and automated processes.
In Keyword-driven testing, keywords represent user actions such as mouse clicks, keystrokes, object selection, etc. As a result, a keyword driven test can be generated by selecting a predefined keyword that represents a specific action, or simply recording the action, depending on the application.
For example, in the below LambdaTest Login form, the keyword āloginā will be used in the automation testing framework to test the login functionality or any action linked to it.
Keyword driven approach helps in various ways. For example, non-technical folks can understand the test automation process as this approach separates coding from test cases and steps. Also, manual testers can quickly write automation test scripts. A highly skilled coder is required who can regularly set up the test framework and update automation scripts in the background.
A keyword driven framework categorizes test cases into four parts:
Keyword driven testing gives you multiple advantages, such as less maintenance in the long run. You can easily maintain the keywords because all keyword-driven tests using these keywords are automatically updated. Test cases are concise and easier to read and understand for non-technical folks.
Shown below are the reasons why one should run keyword driven tests.
In this section of the Keyword-driven testing tutorial, we will discuss some of the benefits of keyword driven tests.
It is easy to create keyword-driven tests. Test actions can be performed by simply dragging and dropping the keywords that correspond to your desired actions, or you can record their actions, and the keyword-driven test will be built.
Following are a few of the benefits of Keyword-driven testing.
In Keyword driven testing, a sequence of operations is recorded using keywords. Keyword driven tests can be run by dragging and dropping relevant keywords to an action.
In this context, the term "keyword" refers to specific user actions incorporated into test cases by defining specific user actions. A test case specification is based on these keywords. In a keyword test case, keywords are connected with actions in a mutual 1:N relationship. A test automation framework implements each keyword into executable code, which is then used to automate tests. With this framework, keyword test cases are converted into automated test cases.
In order to abstract individual actions, high-level keywords are used. To describe associated actions, composite keywords are used. Using keywords for test case maintenance and enhancement benefits their modularity. An operation can be modified quickly with a simple change in the keywords.
The Keyword driven testing process has two phases: the design and development phase and the implementation phase.
A Keyword driven testing framework helps separate the test code and the test data to help maintain your test cases resulting in better-automated testing. Further, incorporating the best test automation frameworks like Selenium for writing keyword driven tests makes your test scripts even more reusable and readable, and cuts short maintenance costs.
A keyword driven testing framework is made up of various operations and instructions that are specified in an excel file. The instructions or test input data from the excel file are read by the test script. The test input data is then entered into the application under test. The test cases are run, and the results are generated. The test output data (results) are recorded in an excel file.
A keyword driven framework requires the following components.
A keyword driven framework's primary objective is to discover some keywords and develop associated functions. You can implement the Keyword-driven testing approach in a variety of ways. The framework can be broadly classified into two types based on keywords.
These keywords will be associated with functions that simply click on an item or enter a value into a text box. In other words, the function mapped with this keyword will only perform one action.
Letās look at the below sample test cases for the above keyword driven framework structures to understand them more effectively.
This section of this Keyword-driven testing tutorial focuses on the differences between data-driven and Keyword driven testing.
When automating tests, you can use various data inputs to achieve a wider test range. With data-driven testing, you run your test with a varied set of input data to ensure that the application will work as expected if the variable values are changed. This technique involves using data as inputs for script actions. In the script, each data set represents a test case. Therefore, the more data sets you provide, the more test cases you have.
On the other hand, Keyword-driven testing allows you to define actions based on keywords. In a script, keywords are used to drive the action. Using the same keywords, you can create a variety of test scripts.
Letās look at how data-driven testing is different from Keyword-driven testing.
Data driven testing | Keyword driven testing |
---|---|
It involves testing using different stored data, values, and variables. | It involves testing using specific keywords. |
Store data in various formats like CSV files, excel sheets, databases, tables, etc. | Store data in excel sheets. |
The user decodes all test scripts. | The user encodes all test scripts. |
It can occur in several stages. | It can occur in two different stages. |
This method is less time-consuming. | This method is more time-consuming. |
It is a time-consuming process. | It is the least time-consuming method. |
It requires coding and technical expertise to run tests. | No coding or technical expertise is required. |
It doesnāt require extensive planning. | It requires extensive planning. |
Keyword-driven testing has some of its own limitations. These are as follows -
Following are some of the tools used to perform Keyword-driven testing.
In Selenium, a keyword driven framework is a mechanism for speeding up automated testing by separating keywords for a common set of functions and commands. All actions and instructions are written in an external file, such as an Excel sheet. Users have complete control over and specify the capabilities they want to test.
A keyword driven framework in Selenium is a testing approach that uses a table of keywords to represent the actions and inputs for each test case. The test cases are then constructed by calling the keywords in a specific sequence to perform the desired testing steps.
In a keyword driven framework selenium, the keywords represent the individual actions that need to be performed during the test, such as opening a browser, navigating to a website, clicking a button, or entering text into a form. The test cases are created by organizing these keywords into a table, with each row representing a specific step in the test and each column representing a different aspect of the step, such as the keyword itself, the object being acted upon, and the data being input.
Ranorex Studio's powerful object recognition, capture, and replay features enable you to build sophisticated tests. By using the tool, you can capture user actions and then add validations to them. Furthermore, you can combine keywords with data-driven testing, global parameters, and conditional execution.
Also, explore the top robot framework interview questions. The robot framework simplifies software testing with Python, making it valuable for online, mobile, desktop, and API testing. Ace your interview with our expertly curated questions.
You can perform both manually and automated Keyword-driven testing However, it is typically used with automated testing.
Automating your keyword driven tests help in,
You can write simple, functional tests with Keyword-driven testing in the early phases of development. The most simple way to create keyword-driven tests is to record them and modify and customize them after the tests have been recorded. You need to link each keyword to at least one command, test script, or function that performs the activities involved with that keyword. When test cases are run, keywords are parsed by a test library, which is invoked by a test automation framework like Selenium.
When running keyword driven tests, testers can choose cloud-based automated browser testing platforms like LambdaTest. It lets you perform Keyword-driven testing on blazing fast online Selenium Grid and exponentially increase your browser coverage by running your Selenium test scripts on a test automation cloud of 3000+ different desktop and mobile environments.
LambdaTest also offers several other test automation frameworks like Cypress, Playwright, and Puppeteer for automated cross browser testing.
Subscribe to the LambdaTest YouTube Channel and get the latest tutorials around Selenium testing, Cypress E2E testing, Responsive testing, and more.
When it comes to mobile test automation, you can automate your mobile application testing with the best app testing frameworks like Appium, Espresso, and XCUITest.
Keyword-driven testing requires a lot of planning, which can be time-consuming and resource-intensive. However, once the keyword-driven framework is set up, the rest of the testing process is much easier.
You can use automated testing frameworks like Selenium to set up your keyword-driven testing framework, even if you do not have any technical knowledge.
Using a Keyword driven testing framework, all operations and instructions are written in an external excel file. Test automation frameworks like Selenium help separate the code and the data to help maintain test cases. This makes it easier to read, reuse, and reduce the cost of maintenance.
Keyword-driven testing is a helpful approach for automating the testing of software applications because it allows tests to be created and maintained by non-technical users. It will enable tests to be run quickly and repeatedly with minimal manual intervention. It is handy when testing applications that have a large number of features or that are subject to frequent changes.
Keyword-driven testing is a testing approach where actions to be performed and data to be used in the test are defined in a table or spreadsheet, and the test is executed by following the steps in the table. Data-driven testing is a testing approach where the test data and expected results are stored in a data file, and the test is executed by reading the data from the file and performing the actions specified in the test. Both approaches are used to automate the testing of software applications.
Behavior-driven development (BDD) is a software development approach that involves defining the desired behavior of a system in human-readable language and writing code to implement it. At the same time, keyword-driven testing is a testing approach that involves defining actions and data in a table or spreadsheet and executing the test by following the steps in the table. BDD is used to drive the development of the system, while keyword-driven testing is used to automate the testing of the system.
Keyword testing is a software testing method where test case design and execution are based on keywords. These keywords represent predefined actions or operations in the application being tested.
Keyword test automation is a technique where automated testing scripts are built using keywords. These keywords correspond to actions to be performed on the application, making the creation and maintenance of automated test cases simpler.
A tester would use a keyword-driven testing framework or tool to define tests using keywords. These tools enable the tester to create tests in terms of keywords, which represent predefined actions or steps in the test scenario.
Keyword-driven testing is advantageous as it enables non-technical stakeholders to participate in test case design and maintenance. It abstracts test case creation away from coding languages, making it more accessible, and promotes reusability and ease of maintenance.
The steps of keyword-driven testing typically include: identifying reusable actions, defining keywords for these actions, creating a keyword-driven test by arranging the keywords logically, executing the test, and analysing the results.
Behaviour Driven Development (BDD) and keyword-driven testing have similarities, but they aren't the same. Both focus on readability and involvement of non-technical stakeholders. However, BDD emphasises more on behaviour specification and communication between stakeholders, while keyword-driven testing focuses more on test design and execution abstraction.
Author's Profile
Salman Khan
Salman works as a Digital Marketing Manager at LambdaTest. With over four years in the software testing domain, he brings a wealth of experience to his role of reviewing blogs, learning hubs, product updates, and documentation write-ups. Holding a Master's degree (M.Tech) in Computer Science, Salman's expertise extends to various areas including web development, software testing (including automation testing and mobile app testing), CSS, and more.
Reviewer's Profile
Shahzeb Hoda
Shahzeb currently holds the position of Senior Product Marketing Manager at LambdaTest and brings a wealth of experience spanning over a decade in Quality Engineering, Security, and E-Learning domains. Over the course of his 3-year tenure at LambdaTest, he actively contributes to the review process of blogs, learning hubs, and product updates. With a Master's degree (M.Tech) in Computer Science and a seasoned expert in the technology domain, he possesses extensive knowledge spanning diverse areas of web development and software testing, including automation testing, DevOps, continuous testing, and beyond.
Get 100 minutes of automation test minutes FREE!!