GOOD PROGRAMMING PRACTICES
Use the same good programming practices for test code as in software development for production code.
This pattern is appropriate when you want your automation scripts to be reusable and maintainable, that is when your test automation is to be long lived.
This pattern is not necessary if you only write short disposable scripts.
Scripting is a kind of programming, so you should use the same good practices as in software development.
If you don’t have an automation engineer, have developers coach the automation testers. Important good practices are:
- DESIGN FOR REUSE: Design reusable testware.
- KEEP IT SIMPLE: Use the simplest solution you can imagine.
- SET STANDARDS: Set and follow standards for the automation artefacts.
- SKIP VOID INPUTS: Arrange for an easy way to automatically skip void inputs
- INDEPENDENT TEST CASES: Make each automated test case self-contained
- ABSTRACTION LEVELS: Build testware that has one or more abstraction layers.
- Separate the scripts from the data: use at least DATA-DRIVEN TESTING or, better, KEYWORD-DRIVEN TESTING
- Apply the "DRY" Principle (Don’t Repeat Yourself), also known as "DIE" (Duplication is Evil)
Put your best practices in a Wiki so that both testers and developers profit from them.
If the software developers don't use good programming practices, then don't follow them, but investigate good programming outside of your company. (Read books!)
Issues addressed by this pattern
If you have used this pattern and would like to contribute your experience to the wiki, please go to Feedback to submit your experience or comment.