AI AGENT · NEW

Write desktop tests

Ask your agent for a desktop test. It drives your Windows app through WinAppDriver or NovaWindows and writes page objects and tests.

Before you start

  • Windows with WinAppDriver or NovaWindows running; see Install.
  • A BELLATRIX C# or Java desktop test project, set up with the desktop skills:
bellatrix init --agent claude --language csharp --domains desktop

What to say to your agent

  • Automate TC-1006.
  • Write a test for the Calculator Scientific mode: 2^10 = 1024.
  • Create a page object for the Date Calculation window.

What you will see

  1. The agent starts the app, or attaches to its open window.
  2. It performs each step in the live app.
  3. Its locator specialist picks a stable locator for each control.
  4. It writes or extends the window's page object and the test, then builds the project.
  5. It closes the app and asks you to run the test.

Where the files end up

One folder per window under Pages/, split into Map, Actions and Assertions. Tests go to Tests/, custom controls to Components/.

public partial class UnitConverterWindow : DesktopPage
{
    public Label OutputValueDisplay =>
        App.Components.CreateByAutomationId<Label>("Value2");

    public WinUiComboBox InputUnitComboBox =>
        App.Components.CreateByAutomationId<WinUiComboBox>("Units1");

    public Button OpenNavigationButton =>
        App.Components.CreateByAutomationId<Button>("TogglePaneButton");
}
Example code from the BELLATRIX demo project: part of a window map (shortened).

Tips

  • The agent prefers AutomationIds, then names. It avoids IDs that change between runs.
  • When a control does not behave like the BELLATRIX built-in one, the agent adds a custom component.
  • Desktop tests need C# or Java. TypeScript covers web only.
Under the hood
  • The agent calls bellatrix desktop start-session --app <name>, snapshot, click and similar verbs, then close-session.
  • Desktop locators are XPath over the UI Automation tree, for example //*[@AutomationId='…'].
  • The CLI never starts WinAppDriver; it connects to http://127.0.0.1:4723 by default.
  • More: How the agent works, desktop commands.