Benefits of Keyword Testing for Automated Testing

Author: SmartBear Software
Applies to: TestComplete 8, 9, 10

This article explains the benefits of the keyword-driven testing and its advantages over test scripts.

The article contains the following sections:

Why Automated Tests?

Testing is an essential part of software development since it lets you measure software quality. Without testing, there is no way to verify that the software works correctly and bugs may be littered throughout the application and left unfound.

Testing is often done manually, by testers performing operations, step-by-step, and indicating whether a particular step was accomplished successfully or whether it failed. However, manual testing is a full-time effort, costly and often prone to human error.

To improve the efficiency of your testing, the testing process can be automated. Test automation allows companies to perform consistent and repeatable tests, save time and money, and improve the testing coverage. Unlike manual tests, automated tests perform precisely the same operations each time they are run, thereby eliminating human error and even cutting costs. Automated tests also run a lot faster, faster than any person could perform a manual test, so this allows companies to run more tests against their application. See Why Automated Tests?

What is Keyword-Driven Testing?

In keyword-driven testing, each keyword corresponds to an individual testing action like a mouse click, selection of a menu item, keystrokes, opening or closing a window or other actions. A keyword-driven test is a sequence of operations, in a keyword format, that simulate user actions on the tested application. Basically, to perform any testing actions, testers simply drag and drop the keyword that corresponds to the desired operation or they can just record their actions and the keyword-driven test is built for them.

Keyword-Driven Tests are Easy to Create

Keywords are organized into tables that represent a test to be executed. You can create keyword-driven tests visually by adding and deleting operations and edit them directly by changing an operation’s parameters and position. The easiest way to create keyword-driven tests is to record them. This technique does not require testers to know the application’s internal objects, just a test plan of what they want to test. After recording, you can modify the keyword-driven test and customize it to fit your needs.

Keyword-Driven Tests vs. Test Scripts

Writing scripts requires knowledge of scripting languages provided by the automated testing tool, whether it is VBScript, JScript or any other scripting language. As you can imagine, creating keyword-driven tests is much easier and faster than writing scripts. Unlike scripts, keyword-driven tests do not require detailed knowledge of scripting languages and can be used to quickly create automated tests. Also, if an automated testing tool only provides scripting, it becomes harder for new testers to become acquainted with the tool, making the learning process for new testers a lot longer and the overall success rate of automated testing suffers.

Create Automated Tests Earlier With Keyword-Driven Testing

Many authorities recommend that you start test automation at the beginning of the application’s design and not wait for the application to be completed. This means creating automated tests for checking each added feature as early as possible. It is a well known fact that fixing bugs detected early is a lot easier and cheaper than finding them later in the development process. However, knowing what and when to automate is very important and there are some best practices for automated testing. With keyword-driven testing, you can create simple functional tests in the earlier stages of development, testing the application, piece-by-piece, and improving your automated testing success rate and do this without having to learn a scripting language.

Create Automated Test Batches With Logic From Keyword-Driven Tests

Keyword-driven tests allow you to introduce logic into the organization of your automated tests. By building some simple decision making logic into a keyword-driven test, you can control how your tests are run. For example, say you have three different tests, Test A, Test B and Test C. Test B is dependent on Test A and Test C is dependent on Test B. With this simple decision making logic in your keyword-driven tests, you can run your automated tests in batches and tailor your workflow so that if Test A fails, Tests B and C won’t run.

About TestComplete

TestComplete is an automated testing tool that supports a wide range of application types, including desktop, mobile, Web and Rich Internet applications, and technologies, including, but not limited to: .NET, WPF and Java. With TestComplete you can create different types of automated tests, for instance, unit tests, functional tests, data-driven tests, regression tests, and many others.

TestComplete can easily be used by experienced and inexperienced testers. Not all testers have a programming or scripting background, so it is important to support all types of testers. TestComplete includes a handy Keyword-Driven Testing feature for users who do not know how to write automated test scripts.

TestComplete provides a number of keyword-driven test operations that let you perform various actions in your keyword-driven tests: performing common tasks, calling object methods, checking object states, searching for an object, and many others. TestComplete also keeps track of keyword-driven test operations that you use most often in your tests and provides quick access to them.

Also, TestComplete provides special keyword-test operations and wizards for data-driven test creation. Using these operations, you can configure your test in several clicks to automatically retrieve data from a database, Excel sheet or CSV file and use this data for simulating user actions on the tested application's windows and dialogs. View a video on our web site to see how easy it is: TestComplete Lesson 5: Creating Data-Driven Tests.

Keyword-driven tests can be made as simple or as powerful as you want them to be. It may not be as powerful as scripting, but when you combine the two you can see benefits that people never thought existed.

Conclusion

This article describes the main benefits of using keyword-driven testing for automated testing. Creating keyword-driven tests is the easiest way to get started automating your tests quickly and can include powerful functionality for testing your applications. If you are interested in using keyword-driven testing with TestComplete, start a free trial today.