E2E testing for Windows native desktop apps (WPF, WinForms, Win32/MFC, Qt) using pywinauto and Windows UI Automation.
复制安装指令,让 AI 自动完成配置 · 推荐新手
请帮我安装 askskill 上的 "windows-desktop-e2e" 技能: 1. 下载 https://raw.githubusercontent.com/affaan-m/ECC/main/skills/windows-desktop-e2e/SKILL.md 2. 保存为 ~/.claude/skills/windows-desktop-e2e/SKILL.md 3. 装好后重载技能,告诉我可以用了
End-to-end testing for Windows native desktop applications using pywinauto backed by Windows UI Automation (UIA). Covers WPF, WinForms, Win32/MFC, and Qt (5.x / 6.x) — with Qt-specific guidance as a dedicated section.
windows-latest)e2e-testing skill (Playwright)All Windows desktop automation relies on UI Automation (UIA), a Windows-built-in accessibility API. Every supported framework exposes a tree of UIA elements with properties Claude can read and act on:
Your test (Python)
└── pywinauto (UIA backend)
└── Windows UI Automation API ← built into Windows, framework-agnostic
└── App's UIA provider ← each framework ships its own
└── Running .exe
UIA quality by framework:
| Framework | AutomationId | Reliability | Notes |
|---|---|---|---|
| WPF | ★★★★★ | Excellent | x:Name maps directly to AutomationId |
| WinForms | ★★★★☆ | Good | AccessibleName = AutomationId |
| UWP / WinUI 3 | ★★★★★ | Excellent | Full Microsoft support |
| Qt 6.x | ★★★★★ | Excellent | Accessibility enabled by default; class names change to Qt6* |
| Qt 5.15+ | ★★★★☆ | Good | Improved Accessibility module |
| Qt 5.7–5.14 | ★★★☆☆ | Fair | Needs QT_ACCESSIBILITY=1; objectName manual |
| Win32 / MFC | ★★★☆☆ | Fair | Control IDs accessible; text matching common |
# Python 3.8+, Windows only
pip install pywinauto pytest pytest-html Pillow pytest-timeout
# Optional: screen recording
# Install ffmpeg and add to PATH: https://ffmpeg.org/download.html
Verify UIA is reachable:
from pywinauto import Desktop
Desktop(backend="uia").windows() # lists all top-level windows
Install Accessibility Insights for Windows (free, from Microsoft) — your DevTools equivalent for inspecting the UIA element tree before writing any test.
The single most impactful thing you can do is give every interactive control a stable AutomationId before writing tests.
<!-- XAML: x:Name becomes AutomationId automatically -->
<TextBox x:Name="usernameInput" />
<PasswordBox x:Name="passwordInput" />
<Button x:Name="btnLogin" Content="Login" />
<TextBlock x:Name="lblError" />
// Set in designer or code
usernameInput.AccessibleName = "usernameInput";
passwordInput.AccessibleName = "passwordInput";
btnLogin.AccessibleName = "btnLogin";
lblError.AccessibleName = "lblError";
// Control resource IDs in .rc file are exposed as AutomationId strings
// IDC_EDIT_USERNAME -> AutomationId "1001"
// Prefer SetWindowText for Name; add IAccessible for richer support
tests/
├── conftest.py # app launch fixture, failure screenshot
├── pytest.ini
├── config.py
├── pages/
│ ├── __init__.py # required for imports
│ ├── base_page.py # locators, wait, screenshot helpers
│ ├── login_page.py
│ └── main_page.py
├── tests/
│ ├── __init__.py
│ ├── test_login.py
│ └── test_main_flow.py
└── artifacts/ # screenshots, videos, logs
import os, time
from pywinauto import Desktop
from config import ACTION_TIMEOUT, ARTIFACT_DIR
class BasePage:
…
基于 C++ Core Guidelines 提供现代、安全、惯用的 C++ 编码规范建议
通过逐步细化检索上下文,提升子代理任务理解与结果质量。
调用最新框架与库文档,快速回答配置、API与代码示例问题
基于多源网页检索与综合分析,生成带引用和来源标注的深度研究报告
帮助你为自适应智能体设计任务编排、评测门控与可复用技能提炼方案
通过并行执行、批量调用与独立验证通道,加速复杂任务且保持结果正确。