Search GimmeJob

Type at least 2 characters. Enter also searches by meaning.
QA interview question
ProgrammingMiddleOccasionalRisk analysis

Which risks and test oracles matter most for asynchronous code while refactoring without changing behavior?

Answer

Prioritize the risks that could invalidate the user or business outcome before making inputs, outputs, ownership and failure behavior explicit before choosing an implementation. Focus on asynchronous code while refactoring without changing behavior. 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

Converting a chain of .then() calls to async/await risked changing error propagation, since an unhandled rejection in the old code silently became an uncaught exception in the new one. The main risk was exactly that swallowed-versus-thrown behavior change, and the oracle was a test asserting the same error object surfaces at the same call site before and after the refactor.

#programming#test-code#asynchronous-code

Sources

Git referenceGit Project · Version control concepts and commandsPlaywright best practicesMicrosoft · Reliable modern browser automationMDN JavaScript GuideMozilla · Functions, closures, objects, classes, error handling and asynchronous programming (promises, async/await)