Skip to content

Write Tests Agent

Shane Neuville edited this page Jan 29, 2026 · 5 revisions

The Write Tests Agent is a specialized AI assistant that determines what type of tests are needed and invokes the appropriate skill.

How to Use This Agent

See Export Your Chat Sessions after completing your work.


When to Use

YES, use this agent if:

  • User says "write tests for issue #XXXXX"
  • User says "add test coverage for..."
  • User says "create automated tests for..."
  • PR needs tests added

NO, use different agent if:

  • "Test this PR manually" → use sandbox-agent
  • "Review this PR" → use pr agent
  • "Fix issue #XXXXX" (no PR exists) → suggest /delegate command

Test Type Determination

The agent analyzes the issue/request to determine what type of tests are needed:

Scenario Test Type Skill Used
UI behavior, visual bugs, user interactions UI Tests write-ui-tests
XAML parsing, compilation, source generation XAML Tests write-xaml-tests
API behavior, logic, calculations Unit Tests (future)
Integration, end-to-end Integration Tests (future)

Currently supported: UI Tests and XAML Tests.

Example Prompts

For UI Tests

write UI test for issue #12345
write UI test for CollectionView item selection
create UI test that verifies Button click updates a Label
write UI test for Android SafeArea issue #12345

For XAML Tests

write XAML test for issue #12345 which is about binding compilation
create XAML test for x:Name resolution
write test for XamlC behavior on markup extensions

What Happens

For UI Tests

The agent invokes the write-ui-tests skill which:

  1. Reads the UI test guidelines
  2. Creates HostApp page in TestCases.HostApp/Issues/
  3. Creates NUnit test in TestCases.Shared.Tests/Tests/Issues/
  4. Verifies tests FAIL (proves they catch the bug)

For XAML Tests

The agent invokes the write-xaml-tests skill which:

  1. Reads the XAML unit test guidelines
  2. Creates XAML and code-behind files in Xaml.UnitTests/Issues/
  3. Builds and runs the test

🛑 Critical Requirement (UI Tests)

Tests must FAIL before the skill reports success. A passing test does NOT prove it catches the bug.

If tests keep passing after 3 iterations, the agent will ask for guidance on reproduction steps.

Output

After completion, the agent reports:

  • Files created
  • Test verification result (FAIL = success for bug reproduction)
  • Failure message (proof tests catch the bug)

File Locations

Test Type Location
UI Tests - HostApp src/Controls/tests/TestCases.HostApp/Issues/IssueXXXXX.cs
UI Tests - NUnit src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/IssueXXXXX.cs
XAML Tests src/Controls/tests/Xaml.UnitTests/Issues/MauiXXXXX.xaml[.cs]

Related Skills

Clone this wiki locally