HeadlessTestingFramework 12.0.0.1
dotnet add package HeadlessTestingFramework --version 12.0.0.1
NuGet\Install-Package HeadlessTestingFramework -Version 12.0.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="HeadlessTestingFramework" Version="12.0.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="HeadlessTestingFramework" Version="12.0.0.1" />
<PackageReference Include="HeadlessTestingFramework" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add HeadlessTestingFramework --version 12.0.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: HeadlessTestingFramework, 12.0.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package HeadlessTestingFramework@12.0.0.1
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=HeadlessTestingFramework&version=12.0.0.1
#tool nuget:?package=HeadlessTestingFramework&version=12.0.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
HeadlessTestingFramework
A comprehensive touch input simulator, gesture recognizer test helpers, tree traversal utilities, and headless screen recorder for testing Avalonia controls.
Installation
dotnet add package HeadlessTestingFramework
Features
- Touch Simulation - Simulate tap, drag, swipe, pinch, and multi-touch gestures
- Keyboard Simulation - Key presses, shortcuts, text input
- Mouse Simulation - Clicks, drag-and-drop, wheel scroll
- Gesture Recognition - Trigger actual Avalonia gesture recognizers
- Tree Navigation - Find controls with fluent API, XPath queries, or type-safe methods
- Tree Validation - Assert visual tree structure with chainable rules
- Tree Comparison - Diff two visual trees for changes
- Appium-like API - Selenium/Appium-style testing with familiar patterns
- Screen Recording - Capture frames during tests for visual regression
Quick Start
using Avalonia.HeadlessTestingFramework;
[AvaloniaFact]
public void Button_Click_Test()
{
var window = new Window { Content = new Button { Name = "MyButton" } };
window.Show();
var button = window.FindFirst<Button>();
var simulator = new TouchInputSimulator();
bool clicked = false;
button.Click += (s, e) => clicked = true;
simulator.Tap(button, new Point(10, 10));
Assert.True(clicked);
}
Which API Should I Use?
| Scenario | Recommended API |
|---|---|
| Simple button click/tap | TouchInputSimulator.Tap() |
| Pinch-to-zoom with gesture handlers | MultiTouchTestHelperFactory |
| Selenium/Appium-style testing | AvaloniaDriver |
| Complex keyboard shortcuts | KeyboardInputSimulator |
| Mouse drag and drop | MouseInputSimulator |
| High-level gesture events | GestureSimulator |
| Find controls by type/name | ControlFinder |
| XPath-like queries | TreeXPath |
| Assert tree structure | TreeValidator |
| Record test interactions | RecordedTouchSimulator |
⚠️ Important: Gesture Handler Registration
When testing gesture events (Pinch, Scroll, etc.), handlers must be registered BEFORE window.Show():
// ✅ CORRECT
var control = new MyControl();
Gestures.AddPinchHandler(control, handler); // Register FIRST
var window = new Window { Content = control };
window.Show(); // Show AFTER
// ❌ WRONG - events won't fire
var window = new Window { Content = control };
window.Show(); // Show FIRST
Gestures.AddPinchHandler(control, handler); // Too late!
Documentation
📖 Full API Documentation - Complete reference with examples
The full documentation includes:
- Detailed API reference for all components
- Code examples for common scenarios
- Appium compatibility matrix
- Migration guides from Selenium/Appium
- Troubleshooting tips
Core Components
| Component | Purpose |
|---|---|
TouchInputSimulator |
Low-level touch event simulation |
GestureSimulator |
High-level gesture events (tap, pinch, scroll) |
KeyboardInputSimulator |
Keyboard input simulation |
MouseInputSimulator |
Mouse input simulation |
GestureRecognizerTestHelper |
Trigger actual gesture recognizers |
MultiTouchTestHelperFactory |
Multi-finger gesture simulation |
VisualTreeTestHelper |
Visual tree queries (extension methods) |
LogicalTreeTestHelper |
Logical tree queries (extension methods) |
ControlFinder |
Fluent control finding API |
TreeXPath |
XPath-like queries |
TreeValidator |
Tree structure assertions |
TreeComparer |
Visual tree comparison |
AvaloniaDriver |
Appium-like API |
HeadlessScreenRecorder |
Frame capture for visual testing |
RecordedTouchSimulator |
Touch + recording integration |
Requirements
- .NET 6.0, .NET 8.0, .NET 10.0, or .NET Standard 2.0
- Avalonia 11.x
License
MIT License - see LICENSE.TXT for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Avalonia (>= 12.0.0)
- Avalonia.Headless (>= 12.0.0)
-
net8.0
- Avalonia (>= 12.0.0)
- Avalonia.Headless (>= 12.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 12.0.0.1 | 108 | 4/10/2026 |
| 12.0.0 | 112 | 4/10/2026 |
| 12.0.0-rc1 | 104 | 3/19/2026 |
| 11.3.9.1 | 135 | 1/11/2026 |