/bawa:test-windows-appfrom bawa
Tests a Windows app at four levels: xUnit unit tests, in-app self-test, UI Automation via PowerShell, and a debug bridge with computer use. Use when adding logic, fixing bugs, or before release.
Ships in bawa. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Four levels, cheapest first. Each new story gets the cheapest level that can prove its acceptance criteria. A bug fix starts with a test that fails.
| Level | Proves | Speed |
|---|---|---|
| Unit tests (xUnit) | Rules, parsing, data, the SQLite store | Seconds |
Self-test (--selftest) | The app's real functions on a test store, every command has a shortcut | Seconds |
UI Automation from outside (scripts/uia.ps1) | What Narrator reads, enabled states, buttons and rows that really work | Seconds |
| Debug bridge + computer use | Global shortcuts, tray, other apps, timing | Minutes |
Snapshots (build-and-verify skill) prove how it looks. This skill proves
how it behaves.
Logic lives in <App>.Core with no WinUI, so tests run without the app.
public class DateParserTests
{
[Theory]
[InlineData("tomorrow 9am", 1, 9)]
[InlineData("next fri", 5, null)]
public void Parses(string phrase, int dayOffset, int? hour)
{
var result = DateParser.Parse(phrase, now: Fixed.Now);
Assert.NotNull(result);
Assert.Equal(dayOffset, result.DayOffset);
Assert.Equal(hour, result.Hour);
}
}
dotnet test tests/<App>.Core.Tests
now: parameter) and the store path in every test.
Store tests get their own file in %TEMP% and delete it, with its
-wal and -shm files, in Dispose.[Theory] with many [InlineData] rows) for anything
with many cases. Keep the table in docs/research/<topic>.md too, and
add a row there before changing behavior.ToString(). Test it:
a type name there ("Tasks.Core.Item") is a screen reader bug.A launch argument that runs the same functions the UI calls, prints PASS or FAIL per step, and exits 0 or 1:
tools/selftest.ps1
# PASS the first page shows the stored items at launch
# PASS New item adds one item
# PASS command 'New item' has a label and a shortcut
# SELFTEST PASS 13 checks
It runs on a fresh seeded store in %TEMP%. Never on the user's data.
Output goes through AgentLog.Line, so it reaches the tool even though a
WinUI app has no dependable stdout.
Checks worth adding to any self-test:
AppBarButton and MenuFlyoutItem has a label and a
KeyboardAccelerator (the template walks the visual tree for this).FontIcon with an unknown code point shows an
empty box, so keep glyphs in one place and check them against a list.tools/common.ps1 kills a run after 180 s and prints TIMEOUT.AgentLog.Exit(code). An open ContentDialog blocks nothing
at exit, but an await on one that never closes does: close dialogs
before the last check.$process.Handle once.
Without it, Start-Process -PassThru reports an empty exit code.-wal and -shm files before a
seeded run. Seed data only fills an empty store.The self-test can run an accelerator's action directly, but to prove the
key itself works, send it from outside (level 3 or 4). Do not use
SendInput from the app to itself: it goes to whatever window has focus,
which is often the agent's terminal.
For a global shortcut, post the message the key would cause:
PostMessage(trayWindow, WM_HOTKEY, id, 0), with the action aimed at a
test window the self-test opened. That proves registration, dispatch, and
the action. An agent's sandboxed shell often cannot inject real key
presses or even find other processes' windows, so the physical key press
stays a [manual] line. A self-test must never act on the window in
front: that is the person's window.
A self-test runs the real code on a real desktop. These patterns kept twelve features' tests safe in one suite:
#FE3B30 for #FF3B30).WM_CLIPBOARDUPDATE to
the feature's own listener so the real message path still runs. Never
write and restore: a restore is never exact, and every write lands in
Win+V history.HKCU\Software\<App>SelfTest) for anything
that writes settings, then read the real value only, and compare it
before and after the run.NotifyIconSettings entry for every exe path that adds an
icon), never the microphone, never a process you did not start.SendInput, check that your test window is in front; otherwise
send nothing, wait, and retry. Mark your own input (dwExtraInfo) so
your hooks can tell it apart.When agents build in parallel (one per feature, each in its own git worktree), their test windows fight for the foreground. Checks that read "which window is in front" fail at random, while everything else passes.
tools/dev.ps1, which never installs.Windows exposes every control to screen readers through UI Automation.
scripts/uia.ps1 uses the same tree to read and drive the running app,
with no change to the app:
$u = "${CLAUDE_SKILL_DIR}/scripts/uia.ps1"
& $u -Process Tasks # every named control: type, enabled, name, shortcut
& $u -Process Tasks -Invoke Delete # FAIL 'Delete' is disabled (nothing selected)
& $u -Process Tasks -Select Groceries # PASS selected 'Groceries'
& $u -Process Tasks -Invoke Delete # PASS invoked 'Delete'
Run it on a seeded test copy started with APP_STORE in %TEMP%. The
listing is also an accessibility review: every button has a name and its
shortcut in brackets, and every row reads as its content.
Checks to write into the app's CLAUDE.md, so every agent runs them
after touching commands:
For behavior the other levels cannot reach: global shortcuts, the tray icon, moving other apps' windows, timing. The running app listens on a named pipe for commands and answers with its state. Code shape: ../../code/os-integrations/recipes.md.
tools/ctl.ps1 status # permissions, flags, open windows, counts, last error
tools/ctl.ps1 snapLeft # runs an action by name
tools/ctl.ps1 selftest # the self-test inside an app that is already running
Commands worth adding:
status: feature flags, registered hotkeys and the ones that failed,
open windows, counts, last error.snapshot:<window>: captures one of the app's windows with
PrintWindow.theme:light|dark|system: switches the app theme for snapshots.selftest: the self-test as a command, for a single-instance app that
is already running.<feature>Probe: runs a slow path and logs the time of each step (see
the performance skill).Compile the bridge into debug builds, or behind a launch flag in release.
Last resort, for what only a person can do: a real key press in another app, drag and drop from Explorer, a UAC prompt. Tell the user to keep off the mouse while it runs. Capture your own window, never the full screen.
Done when every acceptance line of the story maps to a passing test, self-test step, UI Automation check, bridge command, or a named manual check, and the bug fix has a test that failed before the fix.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
C#, .NET, Powershell
windows-testing, xunit, ui-automation, self-test, debug-bridge
npx claudepluginhub daveebbelaar/bawa --plugin bawa22 skills in this plugin
/agent-cliOptional command line and MCP server for a Windows app, so Claude Code, Codex, and scripts can drive it (list, add, change, search, act) through the running app. Use when the user wants agents to work with their app or its data, asks for a CLI, an MCP server, or automation for the app, or says "Claude should be able to use my app"./app-briefOne-page brief (docs/BRIEF.md) for a new Windows app, written before any code. Use when the user has an app idea, wants to replace an app they pay for, or the research and clone skills are done./app-iconWindows app icon drawn as an SVG (Icon/AppIcon.svg), rendered by tools/make-icon.ps1 into a multi-size AppIcon.ico and AppIcon.png, and reviewed on light and dark taskbar and Start backgrounds, with hand-tuned small sizes. Use when the user wants an app icon, a better icon, or a taskbar or Start icon./bawaBuild any Windows app. Start here to pick the next skill for a native Windows app./build-and-verifyBuild a WinUI 3 app from the command line, install it, and check light and dark window snapshots of every page before calling a change done. Use after any UI code change, when a build fails, or when the user asks to run, screenshot, or check the app./cloneWalk through any existing app (native Windows app with computer use, web app with a browser), screenshot every screen, menu, and dialog, write a screen index, and turn it into user stories. Use when the user wants to clone, rebuild, replace, or copy the design of an app, or says "screenshot every screen".Other plugins' skills for the same job