What would you automate for error handling inside a shared test library, and what would you leave manual?
Answer
Before automating, begin by making inputs, outputs, ownership and failure behavior explicit before choosing an implementation. Focus on error handling inside a shared test library. Use small deterministic units plus integration behavior at real boundaries as the oracle. Cover normal flow, invalid inputs, exceptions, concurrency and resource cleanup. Keep data and dependencies controlled enough to reproduce failures. Release only when tests fail for one understandable reason and the code remains easy to change.
Strong answer includes
- explicit risk and test oracle for error handling
- controls side effects and dependencies
- designs for deterministic tests
- measurable evidence and residual-risk statement
Practical example
A shared 'waitForElement' helper swallowed every exception and returned null, so dozens of tests across the suite reported confusing null-reference failures instead of the real timeout error. The team automated a lint rule that flags any catch block in the shared library without re-throwing or logging, but left the decision of exactly which custom exception type to raise in each helper to manual code review.