ExUnit
- ExUnit. ExUnit is built in: test blocks with assertions, run by mix test on every change.
- describe and setup. describe groups related tests; setup builds shared context per test honestly.
- Doctests again. Doctests pull examples into the suite: the docs proven with every run.
Concurrent Testing
- async tests. ExUnit runs test files async when they share nothing: suites that finish in seconds.
- Message assertions. assert_receive waits for expected messages: concurrency tested by protocol, not sleeps.
- Sandboxed state. Shared resources get per-test sandboxes: isolation keeping async honest.
Property-Based Testing Concepts
- Properties. Property tests state invariants: encode|>decode is identity: over generated inputs.
- StreamData. StreamData generates shaped random data: thousands of cases you did not imagine.
- Shrinking. Failures shrink to minimal counterexamples: the bug at its smallest, handed to you.
Before and after this level
- Before: Level 12: Data & State: ETS, Persistent Data Concepts, Concurrent State Architecture.
- Next: Level 14: Performance & BEAM: Scheduler and Processes, Memory and Profiling, Production BEAM Performance.
In the app each of these ideas is taught and then asked back, and the level ends with a checkpoint and flashcards. See Checkpoints and flashcards.
Frequently asked questions
What does Elixir Level 13: Testing cover?
ExUnit, Concurrent Testing, Property-Based Testing Concepts: 3 lessons and 9 ideas.
What should I know before this level?
The level before it, Level 12: Data & State, which covers ETS, Persistent Data Concepts, Concurrent State Architecture.