write-xaml-tests

Generate XAML unit tests for MAUI controls validating parsing and XamlC IL generation.

23.3k|2.0k|Updated May 8, 2020
One-click install
npx skills add https://github.com/dotnet/maui --skill write-xaml-tests
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: write-xaml-tests
Source: https://github.com/dotnet/maui/tree/main/.github/skills/write-xaml-tests
Command: npx skills add https://github.com/dotnet/maui --skill write-xaml-tests

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill automates the creation and maintenance of XAML unit tests for MAUI controls, enabling consistent validation of XAML parsing, XamlC compilation, and source generation without manual test setup.

Core Features & Use Cases

  • Automated XAML unit tests: Generates tests that cover XAML parsing, inflation, bindings, and error scenarios.
  • XamlC and Source Generator testing: Verifies IL generation and code-generation behavior across MAUI controls.
  • Use Case: When you need to reproduce or guard against XAML-related regressions in the Controls.Xaml.UnitTests project.

Quick Start

Create MauiXXXXX.xaml and MauiXXXXX.xaml.cs test scaffolds under src/Controls/tests/Xaml.UnitTests/Issues following the conventions described in the guidelines.

Frequently Asked Questions about write-xaml-tests

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automate XAML unit tests for MAUI controls?

Automating XAML unit tests for MAUI controls is done by generating XUnit-based tests that validate XAML parsing, XamlC IL generation, and source generator output under the Controls.Xaml.UnitTests project to deterministically reproduce regressions.

What does XamlC IL generation testing cover in .NET MAUI?

XamlC IL generation testing covers validating the compiled intermediate language output and source generator behavior for MAUI XAML controls, ensuring that XAML parsing, inflation, and bindings function correctly without runtime errors.

Do I need the .NET SDK and XUnit to write MAUI XAML unit tests?

Yes, writing MAUI XAML unit tests requires the .NET SDK and relies on XUnit-based test projects. The testing conventions also expect test scaffolds like MauiXXXXX.xaml and MauiXXXXX.xaml.cs to be placed in the Controls.Xaml.UnitTests project.

When should I create XAML unit tests for MAUI controls?

You should create XAML unit tests for MAUI controls when you need to reproduce XAML-related regressions, validate error scenarios, or guard against bugs in XAML parsing and source generation within the Controls.Xaml.UnitTests project deterministically.

What's the best way to structure MAUI XAML unit test files?

The best way to structure MAUI XAML unit test files is creating MauiXXXXX.xaml and MauiXXXXX.xaml.cs scaffolds under src/Controls/tests/Xaml.UnitTests/Issues, following the specific MAUI XAML unit test conventions for deterministic regression reproduction.

Can I test XAML source generator output and bindings with this approach?

Yes, this testing approach generates tests that cover XAML parsing, inflation, bindings, and error scenarios while verifying source generator output and XamlC code-generation behavior across MAUI controls for consistent validation.