Why should automation scripts have tests at all?
BeginnerConceptTesting, services & metrics
Answer
Because infrastructure scripts are the code most likely to delete something important. Tests catch the cheap bugs (typo in a dict key, wrong filter, off-by-one on a date cutoff, missing pagination) before they run against production, let you refactor safely, and document the intended behaviour. With moto, tests for AWS logic run in seconds, offline, for free, so there is no excuse to test destructive scripts "live in dev and hope".
More on Testing, services & metrics
How does pytest discover and run tests?BeginnerWhy does pytest use plain `assert` instead of `assertEqual`?BeginnerWhat are pytest fixtures, and what scopes exist?IntermediateWhat built-in fixtures do you use most?IntermediateHow does `@pytest.mark.parametrize` work?BeginnerWhat is moto, and how do you use it with pytest?Intermediate