What problem does it solve?
This guide provides production-ready patterns for testing Elixir applications using Ecto.SQL.Sandbox, focusing on reliable test isolation and proper handling of background processes and Oban.
Core Features & Use Cases
- Manual mode with selective shared mode via test tags to enable fast unit tests and safe integration tests.
- Guidance for managing background processes (GenServers, Oban workers) in tests and ensuring automatic cleanup with start_supervised!/1 and start_owner!/2 patterns.
- Oban testing configuration and patterns to separate enqueueing from execution for deterministic tests.
- Guidance for avoiding global shared mode and for configuring test environments to maximize performance and reliability.
Quick Start
Configure your tests to run with Ecto.Adapters.SQL.Sandbox in manual mode and selectively enable shared mode, then run the test suite to verify isolation and background process handling.