Nu se pretează? Nu contează! Puteți returna produsele în până la 30 de zile
Cu un voucher cadou nu veți da greș. În schimbul voucherului, destinatarul își poate alege orice din oferta noastră.
Până la 30 de zile pentru returnare
Testing FastAPI with pytest
A Practical Guide to Unit Testing, Integration Testing, API Test Automation, Database Testing, Mocking, and Test-Driven Development
Build Reliable, Secure, and Production-Ready FastAPI Applications Through Practical Automated Testing.
Writing a FastAPI application is only the beginning. Building an API that behaves correctly, handles failures gracefully, protects sensitive operations, and remains reliable as it grows requires a solid testing strategy.
Testing FastAPI with pytest provides a practical, step-by-step approach to testing Python REST APIs using pytest, HTTPX, SQLAlchemy, and modern testing techniques. Designed for Python developers and backend engineers, this book takes you beyond basic test examples and demonstrates how to build maintainable, automated test suites for real-world FastAPI applications.
Through hands-on examples and a continuous API project, you'll learn how to:
Master pytest fundamentals: Write effective unit tests, reusable fixtures, parametrized tests, and maintainable assertions.
Test FastAPI endpoints: Use TestClient, HTTPX, and dependency overrides to validate API requests, responses, and error handling.
Implement database testing: Test SQLAlchemy repositories, database transactions, and PostgreSQL-backed applications with isolated test environments.
Verify authentication and security: Test JWT validation, protected endpoints, authorization rules, and access-control boundaries.
Apply mocking and test-driven development: Isolate external services, simulate failures, and use the red-green-refactor workflow to develop reliable features.
Automate testing workflows: Measure test coverage, investigate flaky tests, and integrate pytest with GitHub Actions for continuous integration.
The book also explores asynchronous testing, property-based testing, concurrency scenarios, troubleshooting, and practical techniques for improving long-term software quality.
Whether you're learning FastAPI testing for the first time or strengthening an existing Python backend, this guide will help you develop the skills to detect defects earlier, prevent regressions, and deliver APIs with greater confidence.
Stop relying on manual checks. Start building FastAPI applications backed by meaningful, repeatable automated tests.
Charles J. Dardar
Bună ziua! Sunt Libroamiko, consilierul dumneavoastră de cărți.
Cu ce vă pot ajuta?