Unit tests exercise small, deterministic pieces of your agent in isolation. By replacing the real LLM with an in-memory fake (AKA fixture), you can script exact responses (text, tool calls, and errors) so tests are fast, free, and repeatable without API keys.Documentation Index
Fetch the complete documentation index at: https://langchain-5e9cc07a-preview-mdrxyo-1777658790-7be347c.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Mock chat model
LangChain providesGenericFakeChatModel for mocking text responses. It accepts an iterator of responses (AIMessage objects or strings) and returns one per invocation. It supports both regular and streaming usage.
InMemorySaver checkpointer
To enable persistence during testing, you can use theInMemorySaver checkpointer. This allows you to simulate multiple turns to test state-dependent behavior:
Next steps
Learn how to test your agent with real model provider APIs in Integration testing.Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

