8 Tips To Write a Better Test Automation Framework

The term ‘Automation Framework’ has been a buzz word for a while. Everyone expects an automation framework from any half decent automation tester worth his salt. Management usually just want one set up quickly with little discussion about it’s robustness, maintainability, flexibility.

So, how do we go about setting up Test Automation Frameworks that will last, be usable by other team members and will require minimal maintenance as changes come in?

Here is my list of 8 tips for you:

1) LINK THE UI TO FRAMEWORK

Remember that the user interface should be linked to the framework and NOT the tests themselves so any update should be to the framework and not the tests directly.

2) SIMPLE

Tests should be as simple as possible so anyone can understand and make changes. We want to abstract away the complexity into the framework so anyone non-technical doesn’t get put off and can still contribute.

3) TAKE YOUR TIME

Take your time before you dive into your automation code. Look at the layout of the pages, think carefully about the structure and what may dictate how you do the structure of the framework. For example if you have a number of fields which have ids with the same name as the field names, you could parameterize the ids thereby reusing one line of code.

4) PLAY

This is linked to the above point. Have a good play with application first, go through all the different pages, so you can start thinking about some of the issues you may face which may drive the way you write the framework.

5) FOCUS ON BEHAVIOUR

If you are adopting the page object model, in a page class focus on writing functions that a user would perform. DO NOT WRITE METHODS FOR EVERY ELEMENT OF A PAGE!

6) REUSE

Remember a page object doesn’t necessarily need to be a page. If for example you have a header or footer on each page, that can be a page object too. Try and make as many reusable objects as possible across your framework.

7) STATIC METHODS

This may go against some idealistic rules of programming and some people will even argue against this but use static methods. This will make the framework easier to write for automated tests. People with no programming knowledge don’t have to worry about new objects and variables.

8) BANG FOR BUCK

Always start first writing the tests that give the BIGGEST BANG FOR BUCK. What do I mean by this? These are short tests that test the breadth of the system but not in any great detail. They are designed to quickly tell you if there are any major issues and whether there is any value in testing further. Not only do these give value to the project straight away and thus make you very popular amongst team members but also it will force you to think about your framework as you need to go to many different areas of the application.

There are many others but try to follow these tips to greatly improve your Testing Framework. For more technical testing blogs and information on our services, visit www.trickydefects.com or follow us on twitter (@trickydefects)