2dog.xunit
4.7.1.59
dotnet add package 2dog.xunit --version 4.7.1.59
NuGet\Install-Package 2dog.xunit -Version 4.7.1.59
<PackageReference Include="2dog.xunit" Version="4.7.1.59" />
<PackageVersion Include="2dog.xunit" Version="4.7.1.59" />
<PackageReference Include="2dog.xunit" />
paket add 2dog.xunit --version 4.7.1.59
#r "nuget: 2dog.xunit, 4.7.1.59"
#:package 2dog.xunit@4.7.1.59
#addin nuget:?package=2dog.xunit&version=4.7.1.59
#tool nuget:?package=2dog.xunit&version=4.7.1.59
2dog.xunit
xUnit collection definitions for testing Godot applications with 2dog.
The fixtures themselves (Fixture, HeadlessFixture, and FixtureBase) ship in the
2dog.engine package under twodog.Testing. This package adds the xUnit-specific glue.
What it provides
RenderingCollection- binds the rendering-enabledFixtureHeadlessCollection- bindsHeadlessFixture(use this for CI)
Both set DisableParallelization = true, which is required because Godot allows only one instance
per process.
How it works
xUnit only discovers [CollectionDefinition] classes that live in the test assembly – a
definition shipped in a referenced DLL is silently ignored (its DisableParallelization and
ICollectionFixture<T> are not applied). To make the collections actually work, this package ships
them as compile-in source: a build/2dog.xunit.targets file adds the collection definitions to
your test project's compilation, so they end up in your test assembly where xUnit can find them.
You therefore do not write your own collection definition – just reference the package and use the collections directly.
Usage
using Godot;
using twodog.Testing;
using twodog.Testing.Xunit;
using Xunit;
[Collection<HeadlessCollection>]
public class MyTests(HeadlessFixture godot)
{
[Fact]
public void EngineStarts()
{
Assert.NotNull(godot.Tree);
}
}
Custom fixtures
Need a different Godot configuration? Subclass FixtureBase and
write a one-line collection for it in your own test project:
using twodog.Testing;
using Xunit;
public class OpenGl3Fixture() : FixtureBase("--rendering-driver", "opengl3");
[CollectionDefinition(nameof(OpenGl3Collection), DisableParallelization = true)]
public class OpenGl3Collection : ICollectionFixture<OpenGl3Fixture>;
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- 2dog.engine (>= 4.7.1.59)
- xunit.v3.extensibility.core (>= 3.2.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.