This is a new entry in the series "Magic principles in test automation". Today, I will cover the topic of repetition. To read the last one, please check out Magic principles in test automation: Misdirection.
A common rule of magic states that the same trick should never be repeated twice and it is rather obvious why this seems to be solid advice. The more often a magician repeats the same trick for the same audience, the easier it becomes for the spectators to figure out the secret.
However, in magic this depends on some factors:
Is it a trick that is easy to figure out in the first place?
If the effect requires an obvious secret and only works when done as a one-off surprise, it should not be repeated.
Can you make it seem like the same trick but use a different method every time?
If this is applied, repetition cancels out methods that were used before so it becomes harder to figure out!
Is the trick worth it - is it more amazing if you repeat it?
In certain types of effects (e.g. with a "catch me if you can" premise), repetition is a more than valid option - if doable.
Also, a magician attempting to break the forecited "rule" has to be skilled enough in terms of techniques and so called audience management (directing attention, dealing with hecklers etc.).
In software testing however, repetition should not be an exception case but it essential:
It is possible to rephrase the second sentence of this article so it can be applied to testing:
The more often a test automation system repeats the same test case, the easier it becomes for the testers to figure out how and why something breaks.
Keep in mind that the test case in question has to be meaningful, concise and easy to follow. Otherwise, this can swing to the other extreme and make it a more confusing and less helpful tool for debugging.
In closing, I will leave you with one of my favorite Bruce Lee quotes of all times:
I fear not the man who has practiced 10,000 kicks once, but I fear the man who has practiced one kick 10,000 times.