50 / 80 · 12 Programming for QA · Async/Await Patterns← prev⊞ allnext →☰ Read as one page
6.7Practical Exercise
- Write a test that sends 50 concurrent API requests using
Promise.all/asyncio.gatherand verifies all return 200 - Intentionally create the "forgotten await" bug and observe how the test passes incorrectly. Then fix it.
- Write a test with a timeout: if an endpoint does not respond within 3 seconds, the test fails
- Create two tests that would conflict if run concurrently (shared state), then refactor them to be safe for parallel execution