Chapter 9: Testing an API Asynchronously with pytest and HTTPX
In software development, a significant part of the developer's work should be dedicated to writing tests. At first, you may be tempted to manually test your application by running it, making a few requests, and arbitrarily deciding that "everything works". However, this approach is flawed and can't guarantee that your program works in every circumstance and that you didn't break things along the way.
That's why several disciplines have emerged regarding software testing: unit tests, integration tests, E2E tests, acceptance tests, and more. These techniques aim to validate the functionality of the software from a micro level, where we test single functions (unit tests), to a macro ...
Get Building Data Science Applications with FastAPI now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.