FastAPI · Class
TestClient
TestClient tests FastAPI applications without a real HTTP connection. It works like an HTTPX client and is commonly used with normal pytest functions.
Last updated
Syntax
TestClient(app, base_url="http://testserver", raise_server_exceptions=True, root_path="", backend="asyncio", backend_options=None, cookies=None, headers=None, follow_redirects=True, client=("testclient", 50000))In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
TestingHTTPXAsync TestsWebSocket testingpytest