Skip to content

xUnit Configuration ​

Set properties in MyGame.tests.csproj. Reference 2dog.xunit, which brings in 2dog.engine and the compile-in collection definitions. The global settings control the game directory, resource import, analyzers, and native variant.

ConfigurationDefault nativeUse
DebugdebugDevelopment tests with assertions
ReleasereleaseTests against the production engine
EditoreditorTests using Editor APIs and [Tool] scripts
bash
dotnet test MyGame.tests -c Editor

The generated Editor configuration also defines EDITOR and references 2dog.godotsharp.editor. A manually created test project needs that managed reference to compile Editor API calls; selecting the editor native alone does not add it.

Tests use the game directory and its imported resource cache. See Resource Import to require or force an import, and Testing with xUnit for fixture and runner settings.