本文へスキップ
Skillpedia
テスト280k · #435

windows-desktop-e2e

できること

このツールは、Windows向けに作られたコンピュータプログラムのテストを行うのに役立ちます。UI Automationという技術を使って、ボタンやテキストボックスなどの部品が期待どおりに動くかを確認します。

使う場面

  • ✓Windows向けプログラムのテストを作成するとき。
  • ✓Windowsプログラムの自動テストが失敗するようになったとき。
  • ✓Windowsプログラムをよりテストしやすい構造にしたいとき。

スキルのリンク

https://github.com/affaan-m/ECC/blob/main/skills/windows-desktop-e2e/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/affaan-m/ECC/blob/main/skills/windows-desktop-e2e/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“Windowsプログラムのログインボタンが正しく動作するかをテストするには、どうすればよいですか?”

毎週5つの新しいスキル。1分で読めます。

仕組み

このツールは、Windowsに標準で備わっている機能であるUI Automationを使って、プログラムの画面上の要素を見つけて操作します。ユーザーが行うように、テストでボタンをクリックしたり文字を入力したりできます。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Windows Desktop E2E Testing

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.

When to Activate

  • Writing or running E2E tests for a Windows native desktop application
  • Setting up a desktop GUI test suite from scratch
  • Diagnosing flaky or failing desktop automation tests
  • Adding testability (AutomationId, accessible names) to an existing app
  • Integrating desktop E2E into a CI/CD pipeline (GitHub Actions windows-latest)

When NOT to Use

  • Web applications → use e2e-testing skill (Playwright)
  • Electron / CEF / WebView2 apps → the HTML layer needs browser automation, not UIA
  • Mobile apps → use platform-specific tools (UIAutomator, XCUITest)
  • Pure unit or integration tests that don't need a running GUI

Core Concepts

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 5/5 Excellent x:Name maps directly to AutomationId
WinForms 4/5 Good AccessibleName = AutomationId
UWP / WinUI 3 5/5 Excellent Full Microsoft support
Qt 6.x 5/5 Excellent Accessibility enabled by default; class names change to Qt6*
Qt 5.15+ 4/5 Good Improved Accessibility module
Qt 5.7–5.14 3/5 Fair Needs QT_ACCESSIBILITY=1; objectName manual
Win32 / MFC 3/5 Fair Control IDs accessible; text matching common

Setup & Prerequisites

# 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.

Testability Setup (by Framework)

The single most impactful thing you can do is give every interactive control a stable AutomationId before writing tests.

WPF

<!-- XAML: x:Name becomes AutomationId automatically -->
<TextBox x:Name="usernameInput" />
<PasswordBox x:Name="passwordInput" />
<Button x:Name="btnLogin" Content="Login" />
<TextBlock x:Name="lblError" />

WinForms

// Set in designer or code
usernameInput.AccessibleName = "usernameInput";
passwordInput.AccessibleName = "passwordInput";
btnLogin.AccessibleName = "btnLogin";
lblError.AccessibleName = "lblError";

Win32 / MFC

// 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

Qt — see dedicated section below


Page Object Model

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

base_page.py

import os, time
from pywinauto import Desktop
from config import ACTION_TIMEOUT, ARTIFACT_DIR

class BasePage:
    def __init__(self, window):
        self.window = window

    # --- Locators (priority order) ---

    def by_id(self, auto_id, **kw):
        """AutomationId — most stable. Use as first choice."""
        return self.window.child_window(auto_id=auto_id, **kw)

    def by_name(self, name, **kw):
        """Visible text / accessible name."""
        return self.window.child_window(title=name, **kw)

    def by_class(self, cls, index=0, **kw):
        """Control class + index — fragile, avoid if possible."""

…
よくある質問

Webサイトのテストにも使えますか?

いいえ。このツールはWindowsにインストールされたプログラム専用です。Webサイトの場合は、ブラウザ向けのテストツールを使用してください。

使うには経験豊富なプログラマーである必要がありますか?

いいえ。このツールは簡単に使えるように設計されています。以前は高度な専門知識が必要だったテスト作業を自動化する手助けをします。

「UI Automation」とは何ですか?

Windowsの技術で、プログラム(およびテストツール)が、ボタンやテキストボックスなど他のプログラムの画面上の要素を認識し、操作できるようにするものです。

詳細

作者による元の説明

E2E testing for Windows native desktop apps (WPF, WinForms, Win32/MFC, Qt) using pywinauto and Windows UI Automation. Use when writing E2E tests for a Windows native desktop app with pywinauto or UI Automation.

repo: affaan-m/ECC

人気

GitHubのスター
280k
ランキング
#435
ライセンス
MIT
更新日
2026/10/15

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル