In 2026, Elixir developers can leverage Atlas to efficiently write unit tests for untested code, ensuring new tests adhere to existing repository conventions by using `ExUnit via mix test` and the `mix` build tool. Atlas reads your Elixir module, understands its structure, and then generates a new test file that direct integrates with your project's established testing patterns.
How Atlas identifies untested Elixir functions for ExUnit
Atlas identifies public functions in Elixir modules that require `ExUnit` tests by leveraging its `lsp` tool and `documentSymbol` operation, ensuring no exported symbol is overlooked in 2026. This precise method allows Atlas to build a comprehensive list of functions needing test coverage.
When tasked with writing unit tests for an Elixir module, Atlas first employs its `read` tool to ingest the target module's source code. Following this, Atlas utilizes the `lsp` tool with the `documentSymbol` operation to enumerate all exported symbols within that module. This process is crucial for Elixir, as it allows Atlas to understand the module's public API, ensuring that every public function is considered for testing. Atlas's indexing capabilities, powered by `tree-sitter` for Abstract Syntax Tree (AST) declarations, provide a deep understanding of the Elixir code structure, far beyond simple line windows. This means Atlas can accurately identify functions, macros, and other declarations within your `mix` project, setting the stage for comprehensive `ExUnit` test generation.
How Atlas learns Elixir test conventions for new ExUnit files
Atlas learns your Elixir project's specific `ExUnit` testing conventions by using the `grep` tool to analyze existing test files, ensuring new tests written in 2026 match your repository's style. This approach guarantees consistency in framework usage, import statements, and naming patterns.
To ensure that newly generated `ExUnit` tests integrate direct with an existing Elixir codebase, Atlas employs its `grep` tool. Atlas searches for existing test files, typically found in the `test/` directory and following the `*_test.exs` naming convention. By analyzing these files, Atlas can discern the project's established `ExUnit` framework usage, common import styles (e.g., `use ExUnit.Case`), and naming conventions for test modules and functions. This capability is vital for Elixir developers, as it prevents Atlas from introducing foreign styles or patterns. Instead, Atlas adapts its test generation to mirror the project's current practices, making the new tests indistinguishable from manually written ones and maintaining code quality and readability across the `mix` project.
Writing new Elixir unit test files with Atlas and ExUnit
Atlas drafts new `ExUnit` test files for Elixir modules using its `write` tool, presenting a unified diff for approval before any changes are applied to disk in 2026. This ensures developers maintain full control over the generated test code and its integration.
Once Atlas has identified the functions to test and understood the project's `ExUnit` conventions, it proceeds to write the new test file. Using the `write` tool, Atlas generates a new `ExUnit` test spec file, typically located at `test/my_module_test.exs` for a module named `MyModule`. Before any content is written to your Elixir project, Atlas computes a unified diff, which is then surfaced for your approval. This permission-gated process is a core safety feature, allowing you to review every proposed change. For larger Elixir modules with many untested functions, Atlas can also maintain progress in a `todowrite` list, breaking down the task into manageable chunks and ensuring a systematic approach to achieving full test coverage with `ExUnit`.
Running and iterating on Elixir tests with mix test and Atlas
Atlas executes the newly written `ExUnit` tests for Elixir modules using the `bash` tool to run `mix test`, allowing for immediate feedback and iteration in 2026. This direct execution ensures that tests are not just written but are also verified to be functional and correct.
The true value of a test lies in its execution. After drafting the `ExUnit` test file, Atlas uses the `bash` tool to run the Elixir test suite with the command `mix test`. This command invokes `ExUnit`, executing all tests, including the newly generated ones. Atlas captures the output from `mix test`, allowing it to read and interpret any failures. If the output exceeds 2000 lines or 50 KB, Atlas truncates it for display but saves the full log to a file for your detailed review. Atlas then enters an iterative loop, using the `edit` tool to refine the test code based on the `mix test` failures. This cycle continues until the entire `ExUnit` suite is green, confirming that the new tests are passing and the module behaves as expected within the `mix` project.
Ensuring safety and review for Elixir code changes with Atlas
Atlas ensures safety and developer control over Elixir code changes through permission-gated tool calls and unified diffs for every file edit, providing a secure workflow in 2026. This robust review process applies to all modifications, including `ExUnit` test generation.
Atlas is designed with multiple layers of safety and review, crucial for any Elixir development workflow. Every Atlas tool call, whether it's `read`, `write`, or `bash`, is permission-gated against `allow`, `ask`, and `deny` rules, giving you explicit control. Before making any changes, Atlas drafts a plan in a read-only plan agent and seeks your approval before switching to a build agent. For every file edit, including the creation or modification of `ExUnit` test files (e.g., `test/my_module_test.exs`), Atlas computes and surfaces a unified diff for your approval. Furthermore, Atlas integrates with `git`, reading branches, status, and diffs, and can stage and create commits on your behalf, ensuring that all changes are tracked and reversible. This comprehensive safety framework provides Elixir developers with confidence when using Atlas to modify their `mix` projects.
Step by step
- 01Run Atlas in your Elixir project directory containing a `mix.exs` file to initialize its understanding of your codebase.
- 02Use the Atlas `read` tool to ingest the Elixir module you wish to test, followed by the `lsp` tool's `documentSymbol` operation to enumerate its public functions.
- 03Employ the Atlas `grep` tool to locate existing `ExUnit` test files (e.g., `test/*_test.exs`) to learn the project's specific testing conventions.
- 04Instruct Atlas to `write` a new `ExUnit` test file (e.g., `test/my_module_test.exs`), reviewing the unified diff presented for approval.
- 05Execute the new `ExUnit` tests using the Atlas `bash` tool with the command `mix test` to run the full Elixir test suite.
- 06Review the `mix test` output for failures, and use the Atlas `edit` tool to iterate on the test code until the `ExUnit` suite is green.
- 07For large Elixir modules, utilize the Atlas `todowrite` tool to manage progress and ensure all functions eventually receive `ExUnit` coverage.
- 08Approve the final changes, allowing Atlas to snapshot file changes as `git` patches and stage/commit them on your behalf.
Frequently asked questions
- How does Atlas ensure new Elixir tests match my project's `ExUnit` style?
- Atlas uses its `grep` tool to scan your existing `test/*_test.exs` files. It analyzes the `ExUnit` framework usage, import styles, and naming conventions to ensure any new tests it writes for your Elixir module perfectly match your project's established patterns.
- Can Atlas write `ExUnit` tests for specific functions in an Elixir module?
- Yes, Atlas uses the `lsp` tool's `documentSymbol` operation to enumerate all exported functions in an Elixir module. This allows it to target specific functions for `ExUnit` test generation, ensuring comprehensive coverage for your `mix` project.
- What happens if `mix test` output is very long when run by Atlas?
- If the `mix test` output exceeds 2000 lines or 50 KB, Atlas truncates it for display in the terminal. However, the full log is always saved to a file, which you can access for detailed review of your Elixir `ExUnit` test results.
- How does Atlas handle approval for changes to Elixir test files?
- Atlas computes a unified diff for every file edit, including new `ExUnit` test files (e.g., `test/my_module_test.exs`). This diff is presented for your explicit approval before any changes are written to your Elixir project, ensuring full control.
- Does Atlas support Elixir `mix` projects and OTP applications?
- Yes, Atlas is designed to work direct within Elixir codebases, supporting both standard `mix` projects and complex OTP applications. It reads your `mix.exs` and understands your project structure, including supervision trees and dependencies.
- Can Atlas help refactor Elixir code after writing tests?
- While this page focuses on writing `ExUnit` tests, Atlas's capabilities extend to other Elixir development tasks. It can assist with restructuring a `GenServer` or other modules, always reviewing the diff before applying changes to your `mix` project.
- How does Atlas ensure my Elixir code stays off third-party servers?
- Atlas can build its code index using local Ollama embeddings. This means your Elixir code, including your `mix` project structure and `ExUnit` tests, remains on your local machine, never being sent to third-party servers for indexing or processing.
Try Atlas in your terminal
The terminal-native AI coding agent. Free core, single binary.
Install AtlasRelated guides
Write Unit Tests for Untested Code with Atlas in 2026
How to write unit tests for untested code with Atlas in 2026: the lsp tool enumerates exported symbols, grep copies repo conventions, and bash actually runs the suite.
Atlas for Elixir in 2026
Adopt Atlas, the terminal-native AI coding agent, for Elixir development in 2026. Enhance productivity with deep code understanding, safety features, and direct integration into mix projects and OTP applications.
Rename a symbol across the repo in Elixir with Atlas in 2026
Effortlessly rename Elixir functions, modules, or constants across your entire codebase in 2026 using Atlas. Leverage `lsp`, `grep`, and `edit` for precise, verified refactoring, ensuring your `mix test` suite remains
Extract a shared helper from duplicated code in Elixir with Atlas in 2026
Streamline Elixir refactoring in 2026. Atlas helps Elixir developers find duplicated logic across `mix` projects, extract it into a shared module, and replace copies with calls, all while integrating with `ExUnit via
Run the Test Suite and Triage the Failures in Elixir with Atlas (2026)
Triage a red ExUnit suite in Elixir with Atlas in 2026. Run mix test through bash, read the retained log past the 2000-line truncation, and group causes with grep.
Research a Third-Party API Before Integrating It in Elixir with Atlas (2026)
How to research an external API before writing the Elixir client with Atlas in 2026: websearch, webfetch in markdown, then write the module and run ExUnit via mix test.
Diagnose a Hanging or Long-Running Elixir Command with Atlas (2026)
When mix test or mix deps.get hangs in Elixir, Atlas tells you whether it is slow or blocked on stdin in 2026, then gets it unstuck with a timeout or a CI flag.
Debug a Single Failing Test in Elixir with Atlas (2026)
Fix one red ExUnit test in Elixir in 2026, not the assertion. Atlas isolates it with mix test at a line number, walks the call path with lsp, and edits the real code.