View Source Getting Started
This guide is deliberately explicit so a developer or coding agent can add ExUnit Atlas to an existing project without guessing.
Integration checklist
Add this dependency to the project's
mix.exs:{:ex_unit_atlas, "~> 0.1.0", only: :test, runtime: false}Run
mix deps.get.Find the existing
ExUnit.start()intest/test_helper.exs. Replace that call; do not add a second one. Preserve any formatter the project already needs and add Atlas alongside it:ExUnit.start( formatters: [ ExUnit.CLIFormatter, ExUnitAtlas.Formatter ] )Add
use ExUnitAtlasafteruse ExUnit.Casein every test module that should record behavior:use ExUnit.Case, async: true use ExUnitAtlasIf the project uses a case template such as
MyApp.DataCase, adduse ExUnitAtlasafter that template instead.Wrap meaningful preparation or actions in
step, and guaranteed outcomes incheck. Keep existingassertandrefuteexpressions:result = step "Perform the business action" do perform_action() end check "The business rule holds" do assert result.status == :completed endRun
mix test. The report is generated relative to the project's working directory:ex_unit_atlas_report/report.json ex_unit_atlas_report/index.htmlUsually add
/ex_unit_atlas_report/to the consuming project's.gitignore. Preserve it as a CI artifact when needed.
Existing project templates
Many Phoenix projects use a case template:
defmodule MyApp.OrderTest do
use MyApp.DataCase, async: true
use ExUnitAtlas
endThe order matters because Atlas registers an ExUnit setup callback. The project template must establish the ExUnit case first.
Atlas does not require changes to application/0, a supervision tree, or
runtime configuration.
Important behavior
- Keep the standard ExUnit CLI formatter in the formatter list.
- Do not nest
steporcheck. - Names must be non-empty strings.
- Unannotated tests are included with an empty item list.
- A failing suite writes the report and retains ExUnit's non-zero exit status.
- No application supervision setup is required.
- The output directory is fixed in version 0.1.
- Report names, assertion messages, and stacktraces may contain sensitive business or source information; review artifacts before publishing them.
Troubleshooting
No report is generated
Confirm that ExUnitAtlas.Formatter is in the formatter list passed to the
suite's single ExUnit.start/1 call.
Steps run but do not appear
Confirm that the test module has use ExUnitAtlas after its
use ExUnit.Case or case template.
Normal terminal output disappeared
Add the standard ExUnit CLI formatter back to the formatter list.
A nested block raises ArgumentError
Nesting is intentionally unsupported. Use a linear sequence of sibling
step and check blocks.