gdUnit4.test.adapter
3.0.0
dotnet add package gdUnit4.test.adapter --version 3.0.0
NuGet\Install-Package gdUnit4.test.adapter -Version 3.0.0
<PackageReference Include="gdUnit4.test.adapter" Version="3.0.0" />
<PackageVersion Include="gdUnit4.test.adapter" Version="3.0.0" />
<PackageReference Include="gdUnit4.test.adapter" />
paket add gdUnit4.test.adapter --version 3.0.0
#r "nuget: gdUnit4.test.adapter, 3.0.0"
#addin nuget:?package=gdUnit4.test.adapter&version=3.0.0
#tool nuget:?package=gdUnit4.test.adapter&version=3.0.0
GdUnit4 Test Adapter
This is the GdUnit4 Test Adapter, designed to facilitate the integration of GdUnit4 with test frameworks supporting the Visual Studio Test Platform.
The GdUnit4.TestAdapter implements the Microsoft test adapter framework VSTest.
Features
- Seamless Integration with Visual Studio, VS Code, and JetBrains Rider
- Test Discovery to find all GdUnit4 tests in your project
- Test Execution to run tests directly from your IDE
- Test Debugging to step through your tests
- Error Navigation to jump directly to test failures
- Solution Configuration with test config files
- Powerful Test Filtering to selectively run tests based on various criteria
Supported IDE's
IDE | Test Discovery | Test Run | Test Debug | Jump to Failure | Solution test config file | Test Filter | Parallel Test Execution |
---|---|---|---|---|---|---|---|
Visual Studio | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ |
Visual Studio Code | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ |
JetBrains Rider min version 2024.2 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ |
✅ - supported<br> ☑️ - supported by a workaround (link)<br> ❌ - not supported<br>
Installation
Add the Test Adapter to your test project:
<PackageReference Include="gdUnit4.test.adapter" Version="3.0.0" />
Test Filtering
GdUnit4Net now supports powerful test filtering capabilities, allowing you to selectively run tests based on various criteria such as test name, class, namespace, category, and custom traits.
Basic Filter Syntax
PropertyName=Value
Example Filters
# Run only tests in a specific class
Class=CalculatorTests
# Run tests with a specific category
TestCategory=UnitTest
# Run tests with specific traits
Trait.Priority=High
# Combine filters with logical operators
TestCategory=UnitTest&Trait.Owner=TeamA
For detailed information about test filtering capabilities, including syntax, operators, examples, and best practices, see the Test Filter Guide.
Configuration with .runsettings
GdUnit4Net Test Adapter supports extensive configuration through .runsettings
files, allowing you to customize test execution behavior, environment variables, and
GdUnit4-specific settings.
Basic .runsettings Setup
Create a .runsettings
file in your solution root:
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<RunConfiguration>
<MaxCpuCount>1</MaxCpuCount>
<TestAdaptersPaths>.</TestAdaptersPaths>
<ResultsDirectory>./TestResults</ResultsDirectory>
<TestSessionTimeout>1800000</TestSessionTimeout>
<TreatNoTestsAsError>true</TreatNoTestsAsError>
<EnvironmentVariables>
<GODOT_BIN>C:\Path\To\Godot_v4.4-stable_mono_win64.exe</GODOT_BIN>
</EnvironmentVariables>
</RunConfiguration>
<LoggerRunSettings>
<Loggers>
<Logger friendlyName="console" enabled="True">
<Configuration>
<Verbosity>normal</Verbosity>
</Configuration>
</Logger>
<Logger friendlyName="html" enabled="True">
<Configuration>
<LogFileName>test-result.html</LogFileName>
</Configuration>
</Logger>
<Logger friendlyName="trx" enabled="True">
<Configuration>
<LogFileName>test-result.trx</LogFileName>
</Configuration>
</Logger>
</Loggers>
</LoggerRunSettings>
<GdUnit4>
<Parameters>"--verbose"</Parameters>
<DisplayName>FullyQualifiedName</DisplayName>
<CaptureStdOut>true</CaptureStdOut>
<CompileProcessTimeout>20000</CompileProcessTimeout>
</GdUnit4>
</RunSettings>
GdUnit4 Configuration Options
Setting | Description | Default | Example |
---|---|---|---|
Parameters |
Additional command-line arguments passed to Godot | "" |
"--verbose --headless" |
DisplayName |
Test name format in results | SimpleName |
FullyQualifiedName |
CaptureStdOut |
Capture test output in results | false |
true |
CompileProcessTimeout |
Godot compilation timeout (ms) | 20000 |
30000 |
Using .runsettings
Visual Studio:
- Test → Configure Run Settings → Select Solution Wide runsettings File
- Or place
.runsettings
in solution root (auto-detected)
Command Line:
dotnet test --settings .runsettings
VS Code: Configure in settings.json:
{
"dotnet-test-explorer.runSettingsPath": ".runsettings"
}
Environment Variables
Environment variables defined in .runsettings
are available to your tests:
<EnvironmentVariables>
<GODOT_BIN>C:\Godot\Godot.exe</GODOT_BIN>
<TEST_DATA_PATH>./TestData</TEST_DATA_PATH>
<DEBUG_MODE>true</DEBUG_MODE>
</EnvironmentVariables>
Access in tests:
[Test]
public void TestWithEnvironmentVariable()
{
var godotPath = Environment.GetEnvironmentVariable("GODOT_BIN");
var debugMode = Environment.GetEnvironmentVariable("DEBUG_MODE");
// Use environment variables in your tests
}
Advanced Logging Configuration
Configure multiple output formats for comprehensive test reporting:
<LoggerRunSettings>
<Loggers>
<Logger friendlyName="console" enabled="True">
<Configuration>
<Verbosity>detailed</Verbosity>
</Configuration>
</Logger>
<Logger friendlyName="html" enabled="True">
<Configuration>
<LogFileName>TestResults/test-report.html</LogFileName>
</Configuration>
</Logger>
<Logger friendlyName="trx" enabled="True">
<Configuration>
<LogFileName>TestResults/test-results.trx</LogFileName>
</Configuration>
</Logger>
</Loggers>
</LoggerRunSettings>
Related Packages
- gdUnit4.api - The core testing framework
- gdUnit4.analyzers - Add compile-time validation for your test code
Documentation
The full documentation can be found here.
You Are Welcome To
- Give Feedback
- Suggest Improvements
- Report a Bug related to GdUnit4 API
- Report a Bug related to GdUnit4 Test Adapter
Contribution Guidelines
Thank you for your interest in contributing to GdUnit4!<br> To ensure a smooth and collaborative contribution process, please review our contribution guidelines before getting started. These guidelines outline the standards and expectations we uphold in this project.
Code of Conduct: We strictly adhere to the Godot code of conduct in this project. As a contributor, it is important to respect and follow this code to maintain a positive and inclusive community.
Using GitHub Issues: We utilize GitHub issues for tracking feature requests and bug reports. If you have a general question or wish to engage in discussions, we recommend joining the GdUnit Discord Server for specific inquiries.
We value your input and appreciate your contributions to make GdUnit4 even better!
<p align="left"> <a href="https://discord.gg/rdq36JwuaJ"><img src="https://discordapp.com/api/guilds/885149082119733269/widget.png?style=banner4" alt="Join GdUnit Server"/></a> </p>
Thank you for supporting my project
License
This project is licensed under the MIT License - see the LICENSE file 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 is compatible. 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 was computed. 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. |
-
net8.0
- CommandLineParser (>= 2.9.1)
- coverlet.collector (>= 6.0.4)
- gdUnit4.api (>= 5.0.0)
- Godot.SourceGenerators (>= 4.4.0)
- GodotSharp (>= 4.4.0)
- Microsoft.CodeAnalysis (>= 4.14.0)
- Microsoft.CodeAnalysis.CSharp (>= 4.14.0)
- Microsoft.CodeAnalysis.CSharp.Workspaces (>= 4.14.0)
- Microsoft.NET.Test.Sdk (>= 17.14.1)
- Microsoft.TestPlatform.AdapterUtilities (>= 17.14.1)
- Microsoft.TestPlatform.ObjectModel (>= 17.14.1)
- Mono.Cecil (>= 0.11.6)
- Moq (>= 4.20.72)
- Newtonsoft.Json (>= 13.0.3)
-
net9.0
- CommandLineParser (>= 2.9.1)
- coverlet.collector (>= 6.0.4)
- gdUnit4.api (>= 5.0.0)
- Godot.SourceGenerators (>= 4.4.0)
- GodotSharp (>= 4.4.0)
- Microsoft.CodeAnalysis (>= 4.14.0)
- Microsoft.CodeAnalysis.CSharp (>= 4.14.0)
- Microsoft.CodeAnalysis.CSharp.Workspaces (>= 4.14.0)
- Microsoft.NET.Test.Sdk (>= 17.14.1)
- Microsoft.TestPlatform.AdapterUtilities (>= 17.14.1)
- Microsoft.TestPlatform.ObjectModel (>= 17.14.1)
- Mono.Cecil (>= 0.11.6)
- Moq (>= 4.20.72)
- Newtonsoft.Json (>= 13.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
v3.0.0
* GD-27: Added VSTest filter support with test categories and traits
* GD-138: Added capture test case execution stdout to the test report if `CaptureStdOut` is enabled
* GD-160: Apply runsettings environment variables to the test execution context
## ⚙️ Configuration:
New `.runsettings` options:
```xml
<RunSettings>
<GdUnit4>
<CaptureStdOut>true</CaptureStdOut>
<Parameters>--verbose --headless</Parameters>
<DisplayName>FullyQualifiedName</DisplayName>
<CompileProcessTimeout>30000</CompileProcessTimeout>
</GdUnit4>
</RunSett>
```
--------------------------------------------------------------------------
v2.1.0
Improvements:
* GD-138: Add capture test case execution stdout to the test report if `CaptureStdOut` is enabled
* GD-141: Code cleanup and formatting
--------------------------------------------------------------------------
v2.0.0
- Changed test event sending via std:out to using IPC
- Enable debugging in Rider 2024.2 without using hacks
'gdUnit4.test.adapter' v2.0.0 requires 'gdUnit4.api' v4.3.0
--------------------------------------------------------------------------
v1.1.2
Bug Fixes:
- Fixes the test adapter gdUnit4.api version resolving
- Fixing Debug tests gets stuck when using --verbose
--------------------------------------------------------------------------
v1.1.1
Bug Fixes:
- Fixes space in folder name prevents tests from running
--------------------------------------------------------------------------
v1.1.0
Bug Fixes:
- Fix parameterized tests are incorrect grouped
- Fix DisplayName resolving
Other Changes:
- Add example to show usage of gdUnit4.test.adapter
- Support both net7 and net8 at once
--------------------------------------------------------------------------
v1.0.0
- Initial version