Keyword driven testing approach: why you should or shouldn’t use it
Keyword-driven approach in automated testing is one step away from behavior driven approach. It’s not far from behavior driven approach at comprehension standpoint but much more flexible and easy to re-factor. It is one step away from Object-driven approach, too.
You can use keywords as methods and “keyword arguments” as method arguments. So there is a possible usage of encapsulation, which could help re-using code and reduce time to write new tests. Actually, there are some tools like Robot Framework, which could use keyword driven, behavior driven and object-oriented approaches as well as data-driven one.
The main reason to use keyword driven approach in the project is maintenance costs and in some cases development costs. Maintenance costs are lower than in many other approaches because of easy keyword modification. To refactor or modify them your team should not have specific programming knowledge, the basics would be enough. Also because of inherited from object-oriented approaches modular structure of keywords they could be reused often, which cuts test development costs and lowers maintenance costs even more.
The reasons against the keyword driven approach are the same that could affect your test automation on the whole:
- Tests that you run only one time
- Tests that need to run ASAP
- Tests that based only on user experience
Keyword-driven approach could also be used in manual testing! This will give you flexible testing steps representation and test implementation. And one of the most exciting and debatable part of – you can combine manual steps with automated ones!
Pros
1.Re-usage of keywords
2.Divide et empera:
- Test case implementation does not require learning specific tool or programming language, only SUT domain knowledge.
- Keyword implementation does not require strong domain expertise and rely mostly on tool/programming language knowledge
3.Easy-to-implement abstraction layers
4.Less costly maintenance because of easy test modification, readability and keyword re-usage
Cons
1.Higher learning curve than with behavior driven testing
2.Division of responsibilities requires more intensive process management than with other approaches
Considering the approach benefits and requirements you can decide how to apply the method in test automation or manual testing to gain value.
The article is prepared by Yan Gabis.