What would you automate for asynchronous code when operations can fail or time out, 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 asynchronous code when operations can fail or time out. 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 asynchronous code
- controls side effects and dependencies
- designs for deterministic tests
- measurable evidence and residual-risk statement
Practical example
For an async job queue, the team automated tests that inject a hung promise and assert the configured timeout actually cancels it and marks the job failed, running on every commit. They left manual exploratory testing for the operations dashboard's behavior when many jobs time out simultaneously, since that scenario was hard to script reliably.