- Home
- Unit Testing
- ExUnit
ExUnit
What it is
ExUnit is a unit testing framework for Elixir. In a basic setup, ExUnit.start() starts the framework and tests are defined in a module using ExUnit.Case. In an Elixir project, Mix’s mix test command runs files matching *_test.exs in the project’s test directory. ExUnit.Assertions provides macros for writing checks that produce suitable error messages. Tests in separate modules can run concurrently, while tests within a module run one after another. ExUnit.async_run/0 can begin running tests while test cases are loading, and await_run/1 waits for the result. Result formatters can report outcomes and timing for slow tests or modules. Options include timeouts, parallel-case limits, failure limits, filters, captured logging, colors, and random seeds. Tests may pass, fail, be skipped, be excluded, or be invalid if setup_all fails. ExUnit can also run tests automatically before the VM terminates. It is free, supports Elixir, runs on Linux, and its source code is released under Apache License 2.0.
For and against
For
- Mix runs *_test.exs files from the test directory.
- Separate test modules can run concurrently.
- Formatters can report timing for slow tests.
- Options include filters, timeouts, and random seeds.
Against
- It is a framework for Elixir.
- The listed platform is Linux.
The verdict
ExUnit provides Elixir projects with a built-in path for defining and running unit tests through Mix. Its configurable execution and reporting options help teams shape how test results are produced.
Who it suits
ExUnit suits Elixir developers who want to define, run, and configure unit tests within an Elixir project. Its concurrency and reporting options may be useful for projects with multiple test modules.
Plans and prices
ExUnit
Unit testing framework for Elixir
Read 8 Oct 2026 · ex-unit.hexdocs.pm
On the record
- Assertions
- ExUnit.Assertions provides macros that generate assertions with appropriate error messages.ex-unit.hexdocs.pm · read 8 Oct 2026
- Async execution
- ExUnit.async_run/0 starts tests asynchronously while test cases are loading, and await_run/1 waits for the result.ex-unit.hexdocs.pm · read 8 Oct 2026
- Concurrency
- Tests in different modules can run concurrently, while tests within each module run serially.ex-unit.hexdocs.pm · read 8 Oct 2026
- Configuration
- ExUnit options include test timeouts, maximum parallel cases, failure limits, filters, logging capture, colors, and random seeds.ex-unit.hexdocs.pm · read 8 Oct 2026
- Intended users
- The Elixir website describes Elixir as serving solo developers and Fortune 500 companies across varied industries and applications.elixir-lang.org · read 8 Oct 2026
- License
- The Elixir source code is released under the Apache License 2.0.github.com · read 8 Oct 2026
- Mix integration
- The Mix command mix test runs files matching *_test.exs in a project's test directory.ex-unit.hexdocs.pm · read 8 Oct 2026
- Parallel tests
- Tests in different test modules can run concurrently, while tests within a module run serially.ex-unit.hexdocs.pm · read 8 Oct 2026
- Purpose
- ExUnit is a unit testing framework for Elixir.ex-unit.hexdocs.pm · read 8 Oct 2026
- Reporting
- ExUnit supports result formatters and can report timing for the slowest tests or test modules.ex-unit.hexdocs.pm · read 8 Oct 2026
- Run tests
- Mix's mix test command runs files matching *_test.exs in a project's test directory.ex-unit.hexdocs.pm · read 8 Oct 2026
- Security reporting
- The Elixir repository asks users to disclose security vulnerabilities privately through its Security page.github.com · read 8 Oct 2026
- Support channels
- The Elixir website lists community support channels including Slack, the Elixir Forum, and Discord.elixir-lang.org · read 8 Oct 2026
- Supported runtime
- ExUnit is part of the Elixir programming language and the example invokes it using the elixir command line.ex-unit.hexdocs.pm · read 8 Oct 2026
- Test assertions
- ExUnit.Assertions provides macros that generate assertions with appropriate error messages.ex-unit.hexdocs.pm · read 8 Oct 2026
- Test execution
- ExUnit starts tests and can run them automatically before the VM terminates.ex-unit.hexdocs.pm · read 8 Oct 2026
- Test outcomes
- Finished tests can pass, fail, be skipped, be excluded, or be invalid when setup_all fails.ex-unit.hexdocs.pm · read 8 Oct 2026
- Test setup
- A basic ExUnit setup starts the framework with ExUnit.start() and defines tests in a module using ExUnit.Case.ex-unit.hexdocs.pm · read 8 Oct 2026