Keyword Driven Testing is one of the simplest yet powerful testing methodologies, available both for manual and automated testing of applications. The concept behind keyword driven testing is to simulate user actions on the application being tested using a sequence of keywords. For example, when a user opens a browser, logs in and sends an email, these actions could correspond to keywords such as “openbrowser”, “login” and “email” – for which a test action can then be assigned. These keywords and their associated actions are defined at the time the testing framework is created.
“In a keyword driven testing framework, we create keywords and then associate them with related actions and keep them in separate files also called as Function Libraries. They are then read from these files within actual test scripts. The testing actions that are likely to be accessed by more than just a single test script can become good candidates for Keyword driven testing and can be created as keywords e.g. login, logout, logging test result etc.
Keyword is nothing but a logical convention used for a set of steps that we need to perform on an application and a combination of these keywords leads to a creation of the actual test script. While you are working on a Keyword driven framework, the best practice is to choose a user-friendly keyword name that can best suits the functionality associated with it. The keywords can primarily be categorized into two groups:
High Level Keywords – These are the types of keywords that signifies a particular functionality as a whole. For e.g. login, logout, upload a pic, print a ticket. These keywords are internally comprised of the other low level keywords like click, typing etc.
Low Level Keywords – These keywords are mostly the single step actions. The most common examples of Low Level Keywords are – click, double click, right click, keypress, keyrelease, typing in a textbox, selecting items from a dropdown etc. Sometimes they can even be a combination of more than just one step.
So, the Keyword structure is more dependent on how you have structured your framework.”
– Ms Shruti Shrivastava, Co-founder, http://www.learningbaba.com
These tests are super easy to create, especially when compared to other forms of testing because theydo not require using scripting languages or the knowledge of an app’s internal objects. Instead, testers can simply record a keyword driven test and then customize it by adding or deleting operations as suitable.
Keyword driven testing – Why?
Testing frameworks that depend on a scripting language can be arduous to produce and cumbersome to change. As opposed to this, keyword based testing is faster to produce, and comes with the following benefits:
- Keywords can be reused across different test cases
- It requires low maintenance as test cases are brief and concise
- Easy modifiability of test cases as applications can be tested piece by piece
- Testing is independent of any specific tool or scripting language
- Tests are readable by and useful for non-technical stakeholders such as management team and data analysts
“Keyword drive testing is a great concept for creating a lot of test cases and automating their execution. But the most important thing is not the number of test cases. Coverage and testing specific functional areas is sometimes more important. So keep using your test design techniques and coverage techniques in these cases.”
Jan Jaap Cannegieter, Principal Consultant at Squerist & Digital Director at Business Lease
One of the most widely used tools for keyword driven testing is Selenium, which is an open source web based tool. Since it supports multiple browsers, platforms and languages, it is even more popular. Selenium is actually a suite of four software applications namely Selenium Integrated Development Environment (IDE), Selenium Remote Control (RC), WebDriver and Selenium Grid. Out of these, currently, Selenium RC and WebDriver are together known as Selenium 2. Here’s a snapshot of how the WebDriver works:
- Selenium commands are used for emulating actions on a webpage.
- HTTP requests corresponding to each Selenium command are sent to the browser driver using a HTTP server.
- The HTTP server implements the steps needed for executing the Selenium command on the browser.
- The HTTP server receives the execution status and sends it back to the automation script.
Keyword Driven Testing Automation for Mobile Apps
The explosive growth in the usage of smartphones has given birth to a horde of mobile applications. But the true test of a mobile app lies in its ability to provide a smooth, error free and safe interactive environment. That’s where automated testing comes into play. In case of mobile apps, user actions can be defined on tested processes, controls, windows, menus, as well as social sharing.