What is ExUnit in Elixir?
Answer
ExUnit is Elixir's built-in testing framework. Tests are organized in test modules: defmodule MyModuleTest do; use ExUnit.Case; test "adds numbers" do; assert 1 + 1 == 2; end; end. Key features: assert/refute: intelligent assertions with descriptive failure messages that show the actual and expected values. doctest: test code examples in documentation: doctest MyModule. setup/setup_all: test fixtures — run before each test or once per module. async: true: run test modules concurrently for faster test suites. Mocking: Elixir community prefers dependency injection over mocking — pass modules as arguments. Libraries like Mox provide mock-friendly behaviour-based mocking. Run tests: mix test. Tags and filters: @tag :slow; mix test --exclude slow. ExUnit's clarity and speed make Elixir development test-friendly from the start.