How to design a Test Automation Framework
Actual design of the test automation framework may change depending on the requirements. But here are some learning’s from my past automation experience:
1. Should be scaleable.
2. Should be Cross platform. work on multiple test environments.(as needed). Consider other requirements for technology selection.
3. Should support end to end testing mimicking the actual user behavior. Goal/Vision should be clear at the start.
4. Test libraries should be reusable and independent of projects.
5. Use web services or whatever communication mechanism feasible for all scenarios of the project.
6. Should integrate well with the CI.
7. Sufficient logging and exception handling should be there.
8. Analytic and reporting should be built in.
9. Test classes should be short and compact. Helper functions should contain most of the code.
10. Should be continuously documented
11. Project/Class names should be really well defined so as to reduce redundancy and improve ease of use.
12. As many libraries should be created as possible, even if we are not using the functions at that point of time. Helps in maintainace and updates.
13. should be able to run UI as well as cmd line code. and whatever etc types.
14. Variables should be separately defined if they are dynamic or in case of data driven tests. (preferable read from file etc)
15. Text environment complexities should be handled in helper code so that test case writing is simple and fast.
16. Be extremely careful with variable names. minimise the use of names that are elsewhere used in the project.
17. Define coding guidelines at the start.
18. Define a good structure at the start to encourage code reusability and decrease complexity.
19. Keep all functions parametrized.
20. create setup and teardown classes/functions.
21. sequential vs independent tests?
22. should be able to calculate the code coverage.
23. Code reviews are extremely important. Get code reviewed from senior experienced people/ architects.