Hey Eric,
The right ones are the ones where the risk you are mitigating presents itself on that UI layer, or your testability dictates that you canāt test it any lower than the UI.
TRIMS is the heuristic Mark and I created for Automation in Testing (AiT), which we use to review our automated checks.
Are they targeted, as mentioned to Risk, and layer based on testability. Risk is based on system behaviour we are trying to mitigate. Who is the actor? What are the actions that actor is doing? When testing an API, the Actor is another system wanting to talk HTTP(S). Their actions are to send data/call APIs, there behaviour is to get data from your system, or to give you some. Identifying the actor usually leads to identify the right layer. Then testability detects if you can automate there.
Reliable focuses on them being deterministic. If checks are targeted, they are usually more atomic, aka, small. Less moving parts. Less system traversing. Less data. Which usually means, more robust checks and less flake. We talk about this as Visual Task Analysis with AiT.
Informative. Checks are living documentation. Which means they are very prone to change, and often do detect change. This is exactly what we want them to do. But when that change is detected, we need them to really help us out. We should code/design to be very clear about that intentions, via their name, and codified oracle (assertions). Well named steps and methods speed up investigation. Data gathering for reporting is crucial, screenshots, videos, HTML dumps, json dumps, logging etc. All this helps us understand if we have a problem, and gets the checks back to checking.
Maintainable focusing on making them easier to maintain, to change tooling, data and so forth. Technology moves very fast, so we should design our frameworks to keep up.
Speedy. We need things to be quick. Creating them. Running them. Debugging them. Maintaining them. āFixingā them. We talk about Mean Time to Feedback (MTTF) in AiT, as thatās what automated checks give us, feedback and information. The sooner we get it, the sooner we can make decision on more testing/releasing and much more.
So, the goal should be to have TRIM automated checks. If youāve decided that automating there is the right move.
But important thing to remember with goals, is they are fluid, as they should be based on a strategy. What is your team trying to do right now, whatās the problem that led to you thinking you needed Selenium tests, and is automating on the UI the right solution? Problems before Tools, focuses on this. We often jump to the armoury we already have, instead of targeting on the problem.