45 / 80 · 12 Programming for QA · Async/Await Patterns← prev⊞ allnext →☰ Read as one page
6.2Why Async Matters for QA
When your test clicks a button, the browser does not instantly update. When your test sends an API request, the response does not arrive instantly. Asynchronous programming provides a way to write code that waits for these operations without blocking the entire test run.
| Synchronous | Asynchronous |
|---|---|
| Each operation blocks until complete | Operations can run concurrently |
| Simple to reason about | Requires understanding of event loop |
| Slow for I/O-heavy tasks | Fast for parallel I/O operations |
requests.get() |
await httpx.get() |