Anti-patterns for automations


As with any project, it is pretty easy to implement patterns that "just don't feel right" or seem complex. It is also common to "inherit" patterns from previous tools and projects without noticing the problems.

Below, we are collecting a simple list of the "anti-patterns" we have seen. We are growing the list as we get the time and find common patterns, but if you know of an additional one, please just ping us in Slack ๐Ÿš€

Do NOT use extended/endless retries

๐Ÿ’ก "The definition of insanity is doing the same thing and expecting a different result."

Search for: Wait Until Keyword Succeeds, retry loops, etc.

  • Retries are normally built-in, so just using features like wait for element with a reasonable timeout does the same thing in a much faster and more understandable form.
  • In code-based automations, when something fails, a blind retry very rarely works; it is a LOT better to identify the actual case than retry.
  • Retrying failing keyword multiple times is inefficient and slows down the development cycle
  • Extra retry logics usually just end up slowing down testing and execution of the automation

Avoid using 'taskkill' in Windows automation

๐Ÿ’ก "If you need to send an email, do you first go to the circuit breaker of the room and perform off/on cycle?"

Search for: taskkill

  • You need to be sure you are not killing processes that others are using.
  • You should find the process left open by your robot and handle them in teardown logic gracefully, ending the process like it would normally (manually) closed
  • Taskkill is always brutal and sudden so that it may leave your target application in a broken state for the subsequent execution
  • "With great power comes great responsibility." ๐Ÿ˜‰

Do not sleep on the job

๐Ÿ’ก "In a 100m dash, do you go when the starting pistol goes off, or do you ask someone every 10s if the pistol has been fired?"

Search for: Sleep and time-based wait loops.

  • With sleep you need to estimate the time for the worst-case scenarios without knowing where the automation runs, so these timeouts will always have a lot of extra time wasted.
  • Using the wait for an element to appear -pattern with sensible timeouts, the automation will continue immediately when the element appears without always waiting for a full sleep timer.
Last edit: September 7, 2023