fr

Automated Tests And Keyword-Driven Testing

08.01.2019

Test automation is an important part of developing software solutions under a continuous integration model. Test scripts, which are developed at the same time as the software solution itself, are executed regularly to quickly detect bugs or identify areas where the application has regressed because of new code that’s been added.

Since a software solution changes and evolves throughout development, being able to update and revise test scripts quickly and efficiently is very important. After all, our main goal is to save time and money, which flexible test scripts can help us do.

This is where keyword-driven testing comes into play.

What is Keyword-Driven Testing?

Let’s say you’re in charge of writing scripts that will automate all tests for a web platform. Traditionally, you would start by writing test scenarios, which you would then convert into code, in a programming language like Python or Groovy.

Your test scenarios will be broken down into simple steps and operations. Each operation will describe an action that the script should perform without going too deeply into technical details. Essentially, these test scenarios will resemble instructions that you would give to a human user so that he or she could test your software solution manually.

As you can see, there are two distinct processes. The first involves writing test scenarios, and the second involves fleshing out the programming scripts that will execute these scenarios. What makes keyword-driven testing so interesting and so advantageous is that it unifies these two processes.

What Exactly Makes Keyword-Driven Testing so Awesome?

Keyword-driven testing is both a very simple and very powerful testing method that greatly reduces the amount of time and energy needed to develop test scripts. Each keyword represents a simple sentence that can be reused in multiple test scenarios.

For example, if we create a keyword related to pressing a button, we can then reuse that keyword in any scenario that involves a button being pressed, without having to write a single additional code line.

Keyword-driven testing example

In other words, since each keyword represents an individual operation within a test scenario, revising or updating our test scripts is therefore fairly simple. To add a new operation to a test scenario, all we have to do is insert the correct keyword at the right place. To remove an operation, we simply delete the corresponding keyword.

Results are precise and easy to parse. If a bug is detected somewhere in the software solution, the script fails and indicate which keyword caused a problem. Since the keyword corresponds to a specific operation within the test scenario, it’s very easy for the development team to figure out what went wrong and how to fix it.

What Do I Gain from Using Keyword-Driven Testing?

Keyword-driven testing has many advantages. They include:

  1. Lower Barrier of Entry. Once the platform is set up, manual testers can start creating tests even if their technical skills are limited. In other words, you don’t have to hire new team members with a specific knowledge base.
  2. Easy To Read. With keywords, test scripts become easy to read and understand. A project leader or data analyst, for example, will be able to grasp quickly what a specific test was scripted to accomplish.
  3. Early Start. You can start scripting tests earlier in the development cycle, allowing the team to test functionalities very early in development. As the application grows, functionalities and test scripts can be developed conjointly.
  4. Components Can Be Re-Used: To save time, older test scripts can be re-used by changing a variable or tweaking them slightly.

In a nutshell: Less time and energy is needed to flesh out, revise and update test scripts, which allows you to create more test scripts overall and work more easily towards fully automating all your tests.

Extended Librairies

Another advantage is that libraries can be extended. While the general library of keywords is usually robust enough to handle most test cases, some projects have such specific needs that new keywords are required. In this situation, it might be preferable to have a toolsmith on the team who can script new keywords depending on the situation.

Lastly, a keyword-driven testing approach allows you to test as much (or as little) as you want. Want to automate tests for your entire application? We can work on that! You only have limited resources, but would like to automate tests for a specific module of your application? We can do that, too.

Leverage the Power of Keywords

Keyword-driven test automation is an awesome solution to create adaptable test cases. It empowers teams by giving them the ability to script tests quickly and smoothly while also retaining flexibility. In many Agile teams, both developers and QA specialists are now expected to contribute to the testing code base.

The boundaries between the different disciplines are blurring: developers are moving towards testing while testers are handling tasks that once required coding. As a whole, developers and QA specialists are both encouraged to leave the silo mentality behind and collaborate on software quality.

If software quality is important to you, the best way to ensure that your team delivers software quality you can be proud of is to test everything thoroughly all throughout development. The more test scripts you have, the more bugs will be identified and fixed before the software solution is delivered, which, of course, guarantees better software quality.

Keyword-driven testing can help you achieve your goals by giving you access to powerful keyword libraries right from the start, making the test scripting process much easier.

If testers on your team are skeptical that keyword-driven testing is the way to go, make sure to show them what their role would look like when using keywords instead of testing everything manually. They’ll see how incredibly powerful keywords can be and how the tester’s role as part of the team will require more creativity and more strategic thinking.

Have you used keyword-driven testing as part of your development projects? How did it go? Let us know in the comments!