Gua.Testing.Visual 0.15.0

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

Gua.Testing.Visual

Gua.Testing.Visual adds opt-in PNG baseline comparison to ordinary .NET tests. The package targets both net10.0 and netstandard2.1. Semantic assertions should remain the primary test path; visual comparison covers rendering regressions such as clipping, misplaced controls, incorrect assets, and unexpected overlays. PNG codec dependencies stay out of Gua.Testing and Gua.Testing.Godot unless a visual test explicitly references this package.

Basic usage

Capture or update a baseline deliberately, then compare later runs:

using Gua.Testing.Visual;

var result = await GuaVisualAssertions.ExpectScreenshotAsync(host.Context, "title-screen", new()
{
    BaselineDirectory = Path.Combine(TestContext.CurrentContext.TestDirectory, "baselines"),
    ArtifactDirectory = Path.Combine(TestContext.CurrentContext.WorkDirectory, "artifacts", "gua"),
    BaselineVariant = Environment.GetEnvironmentVariable("GUA_VISUAL_VARIANT")
        ?? "local-windows-godot-gl-compatibility",
    PixelThreshold = 0.02f,
    MaxDifferentPixelRatio = 0.001,
    WaitForStableSnapshot = true,
});

Missing baselines fail unless UpdateBaselines = true or GUA_UPDATE_BASELINES=1 is explicit. A failed comparison writes expected.png, actual.png, diff.png, and comparison.json. Pass the failure artifact path returned by GuaDiagnosticWriter as FailureDirectory when visual artifacts should share the same diagnostic directory.

Use masks only for genuinely nondeterministic regions such as a clock or generated avatar. Masks are excluded from both the diff and the compared-pixel denominator; dimension mismatches never resize implicitly.

Baselines in CI

Commit reviewed baseline PNGs to the test repository. Normal pull-request and main branch jobs must run without GUA_UPDATE_BASELINES; a missing or changed baseline must fail the job and upload the Gua artifact directory for review. Keep baseline updates in an explicit developer command or manually dispatched workflow, review the PNG diff, and commit the accepted files. Do not let an ordinary CI job update and accept its own baselines.

Example GitHub Actions steps:

- name: Run rendered visual tests
  shell: pwsh
  env:
    GUA_VISUAL_VARIANT: windows-godot-gl-compatibility
  run: dotnet test tests/Game.Visual.Tests/Game.Visual.Tests.csproj --configuration Release

- name: Upload visual failures
  if: failure()
  uses: actions/upload-artifact@v4
  with:
    name: gua-visual-failures
    path: artifacts/gua
    if-no-files-found: ignore

OS and renderer variants

Gua never infers variants from the current machine. Choose a stable, explicit name that describes every rendering input allowed to produce a different baseline, for example:

  • windows-godot-gl-compatibility
  • windows-godot-forward-plus
  • linux-godot-gl-compatibility

Set the variant from the CI matrix or a repository-owned helper and pass it through BaselineVariant. Keep resolution, DPI scaling, font files, locale, theme, engine version, renderer, and GPU/driver policy deterministic. Do not create a new variant for arbitrary transient differences; that hides regressions instead of explaining them.

Operation recording and replay live in the separate Gua.Testing.Recording package and do not pull PNG dependencies into non-visual test projects.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 was computed.  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 netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen 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
0.15.0 106 7/14/2026
0.14.0 96 7/14/2026