Automating the automation – a practical example
The general recommendation for test code writing is to make the tests short and simple. This way, we can identify the failing parts easily and clearly. However, sometimes, the time spent creating these simple tests surpasses that of the time of testing the parts that are likely to fail. The key is to find balance and try to reduce the time spent writing repetitive and predictable code.
We have seen before a few examples in which writing automation becomes a tedious and repetitive task: having to type the finders, create methods per object with repetitive header code, and tweak slight changes between them. We also mentioned that if we want the finders to fall through different locators (which will make the tests more robust in case those locators are lost), we will require repetitive code to do this.
Let us break down the process of automation again (as we did in Automating the automation section of Chapter 1, Introduction...