HeadlessTestingFramework 11.3.9.1

dotnet add package HeadlessTestingFramework --version 11.3.9.1
                    
NuGet\Install-Package HeadlessTestingFramework -Version 11.3.9.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="11.3.9.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="HeadlessTestingFramework" Version="11.3.9.1" />
                    
Directory.Packages.props
<PackageReference Include="HeadlessTestingFramework" />
                    
Project file
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 11.3.9.1
                    
#r "nuget: HeadlessTestingFramework, 11.3.9.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@11.3.9.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=11.3.9.1
                    
Install as a Cake Addin
#tool nuget:?package=HeadlessTestingFramework&version=11.3.9.1
                    
Install as a Cake Tool

HeadlessTestingFramework

A comprehensive touch input simulator, gesture recognizer test helpers, tree traversal utilities, and headless screen recorder for testing Avalonia controls.

NuGet License

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 Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
11.3.9.1 104 1/11/2026