Atlas empowers Phoenix developers in 2026 to efficiently write unit tests for untested modules, ensuring full coverage and adherence to existing project conventions. It leverages the `mix test (ExUnit)` runner, `Hex (mix deps.get)` for dependencies, and `mix format` for code style, integrating direct into your familiar Phoenix development environment.
How Atlas Identifies Untested Phoenix Code and Existing Conventions
Atlas begins by thoroughly understanding your Phoenix codebase, identifying modules lacking tests and learning your project's specific testing conventions. In 2026, Atlas uses its `read` tool to ingest the target module and the `lsp` tool's `documentSymbol` operation to enumerate all exported functions, ensuring no public interface is missed.
To add real tests for a Phoenix module that currently has none, Atlas first uses its `read` tool to parse the module's source code, such as `lib/my_app/accounts.ex`. Following this, the `lsp` tool's `documentSymbol` operation is employed to precisely list every public function exported by that module. This guarantees that Atlas will generate test cases for all accessible functions, including those handling Ecto changesets or LiveView sockets. Concurrently, Atlas uses the `grep` tool to search for an existing test file within your project, for example, `test/my_app/accounts_test.exs`. This step is crucial for Atlas to accurately replicate your repository's established testing framework, import style, and naming conventions, ensuring the new tests integrate perfectly with your existing `mix test (ExUnit)` suite.
Writing Phoenix Test Files with Atlas's Permission-Gated Tools
Atlas drafts new Phoenix test files, such as `test/my_app/new_feature_test.exs`, using its `write` tool, always presenting a unified diff for your approval before any changes are committed. This process ensures that every test case, whether for a Phoenix context or a LiveView component, aligns with your project's specific `ExUnit` setup and coding standards in 2026.
Once Atlas has a clear understanding of the module to be tested and the project's testing conventions, it proceeds to write the new test spec file. For instance, if you are testing `lib/my_app/blog/post.ex`, Atlas might create `test/my_app/blog/post_test.exs`. This is accomplished using the `write` tool, which is permission-gated. Before any content is written to disk, Atlas computes and displays a unified diff of the proposed changes directly in your terminal. This allows you, the Phoenix developer, to review every line of the new `ExUnit` test file, including assertions for Ecto changesets or LiveViewTest cases, and explicitly approve or deny the write operation. This transparent process ensures that Atlas's output matches your expectations and adheres to your project's `mix format` standards.
Executing Phoenix Tests and Iterating with Atlas
After writing the initial test suite, Atlas immediately executes the tests using the `bash` tool to run `mix test (ExUnit)`, providing instant feedback on failures. This iterative process, common in 2026 Phoenix development, allows for rapid debugging and refinement until all 100% of the new tests pass, ensuring robust code quality.
The true value of a test lies in its execution. Atlas uses the `bash` tool to run your Phoenix test suite with the command `mix test`. This command invokes `ExUnit`, the standard Phoenix test runner, to execute the newly generated tests alongside your existing ones. Atlas captures the output of `mix test`, displaying failures directly in the terminal. If the output exceeds 2000 lines or 50 KB, Atlas truncates it for readability and saves the full log to a file for your detailed review. Atlas then enters an iterative loop, using the `edit` tool to make necessary adjustments to the test file or the module under test based on the `mix test` failures. For larger modules, Atlas can maintain a `todowrite` list to track progress, ensuring all functions, including complex Ecto contexts or LiveView modules, are thoroughly tested and the suite eventually turns green. This cycle continues until all tests pass, confirming the correctness of the new test cases and the underlying Phoenix code.
Ensuring Phoenix Code Quality with Atlas's Review and Safety Features
Atlas integrates robust review and safety features throughout the testing workflow, from initial plan drafting to final file writes, ensuring your Phoenix codebase remains secure and consistent. Every Atlas tool call is permission-gated, and all file edits are presented as diffs for explicit approval, providing a 2026 standard of control over your development process.
Atlas is designed with developer control and safety as paramount concerns. Before any action is taken, Atlas drafts a plan in a read-only plan agent, allowing you to understand its intended steps. Every tool call, including `read`, `lsp`, `grep`, `write`, `bash`, `edit`, and `todowrite`, is permission-gated against allow, ask, and deny rules. This means you explicitly grant Atlas permission to interact with your Phoenix project. When Atlas proposes to write or modify a file, such as a new `test/my_app/user_test.exs` or an update to `lib/my_app/accounts.ex`, it computes a unified diff and surfaces it for your approval. This transparent diffing mechanism, combined with Atlas's ability to snapshot file changes as git patches, allows you to review every proposed change, ensuring that the generated `ExUnit` tests and any code modifications align with your project's standards and do not introduce unintended side effects. Atlas also reads git branches, status, and diffs, and can stage and create commits on your behalf, further streamlining the integration of new tests into your Phoenix repository.
Step by step
- 01Start Atlas in your Phoenix application directory, ensuring `mix.exs` and `lib/<app>_web` are present.
- 02Instruct Atlas to `read` the target Phoenix module, for example, `lib/my_app/accounts.ex`, and use the `lsp` tool's `documentSymbol` operation to enumerate all its exported functions.
- 03Ask Atlas to `grep` for an existing test file, such as `test/my_app/accounts_test.exs`, to learn your project's `ExUnit` conventions, import style, and naming patterns.
- 04Have Atlas `write` the new test spec file, for instance, `test/my_app/new_module_test.exs`, reviewing the unified diff presented for approval before it lands on disk.
- 05Use the `bash` tool to run the Phoenix test suite with `mix test`, observing the output for any failures in the newly added `ExUnit` cases.
- 06If tests fail, instruct Atlas to `edit` the test file or the module under test, iterating until all `mix test` cases pass, using `todowrite` for large modules.
- 07Once tests are green, ask Atlas to run `mix format` to ensure the new test file adheres to your project's code style.
Frequently asked questions
- How does Atlas ensure new Phoenix tests match my existing `ExUnit` style?
- Atlas uses the `grep` tool to analyze your existing `test/` directory, identifying the `ExUnit` framework, import patterns, and naming conventions used in your Phoenix project. It then applies these learned styles when generating new test files, ensuring consistency.
- Can Atlas test Phoenix LiveView components and Ecto changesets?
- Yes, Atlas is designed to understand Phoenix contexts, LiveView sockets, and Ecto changesets. It can generate `LiveViewTest` cases and assertions for Ecto changesets, ensuring comprehensive testing for these core Phoenix components.
- 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 the display in the terminal for readability. The full log is automatically saved to a file, which you can then review in detail to diagnose complex Phoenix test failures.
- How does Atlas prevent accidental changes to my Phoenix codebase?
- Atlas employs several safety mechanisms: it drafts plans in a read-only agent, all tool calls are permission-gated, and every file edit, including new test files or code modifications, is presented as a unified diff for your explicit approval before being written to disk. It also snapshots changes as git patches.
- Can Atlas help me refactor Phoenix business logic into contexts before testing?
- Yes, Atlas can assist with Phoenix refactoring. You can ask Atlas to move business logic out of a controller into a context function that returns an `ok` or `error` tuple, preparing your code for more robust and testable unit tests.
- Does Atlas integrate with `mix format` for Phoenix code style?
- Absolutely. After generating and passing tests, Atlas can be instructed to run `mix format` on the newly created test files or any modified code. This ensures that all changes adhere to your project's established Phoenix code formatting standards.
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 Phoenix in 2026
Atlas is a terminal-native AI coding agent for Phoenix in 2026. It reads contexts, LiveView modules, and Ecto changesets, then runs mix test behind a prompt.
Trace a Runtime Bug from a Stack Trace in Phoenix with Atlas in 2026
Pinpoint and fix runtime bugs in Phoenix applications using Atlas in 2026. Go from a production stack trace to the exact line of code and a solution, leveraging Phoenix's mix test and Ecto changesets.
Rename a symbol across your Phoenix repo in 2026 with Atlas
Rename functions, classes, or constants across your Phoenix codebase with Atlas in 2026. Leverage mix test (ExUnit) and mix format for safe, precise refactoring.
Upgrade a Dependency and Fix Breakage in Phoenix with Atlas in 2026
Phoenix developers in 2026 use Atlas to direct upgrade dependencies and resolve compile and test failures. Atlas drives Hex, ExUnit, and mix format, ensuring a smooth transition for your Phoenix applications.
Automate GitHub Issue and Pull Request Triage in Phoenix with Atlas in 2026
Streamline GitHub issue and PR triage for your Phoenix projects using Atlas. Automate responses, enforce safety, and integrate with your `mix` toolchain for efficient development in 2026.
Extract a Shared Helper from Duplicated Code in Phoenix with Atlas in 2026
Refactor your Phoenix application in 2026 by extracting duplicated logic into a single, tested helper using Atlas. Find semantic duplicates, create new modules, and apply changes with full diff review.
Run the Phoenix Test Suite and Triage Failures with Atlas in 2026
Efficiently triage Phoenix test failures in 2026 with Atlas. Turn a wall of `mix test` output into a prioritized list of distinct root causes, leveraging Atlas's AI for faster debugging and resolution.