gdUnit4.api
4.4.0-rc6
dotnet add package gdUnit4.api --version 4.4.0-rc6
NuGet\Install-Package gdUnit4.api -Version 4.4.0-rc6
<PackageReference Include="gdUnit4.api" Version="4.4.0-rc6" />
paket add gdUnit4.api --version 4.4.0-rc6
#r "nuget: gdUnit4.api, 4.4.0-rc6"
// Install gdUnit4.api as a Cake Addin #addin nuget:?package=gdUnit4.api&version=4.4.0-rc6&prerelease // Install gdUnit4.api as a Cake Tool #tool nuget:?package=gdUnit4.api&version=4.4.0-rc6&prerelease
The C# GdUnit4 API
What is GdUnit4.Api
gdUnit4.api is the C# package to enable GdUnit4 to run/write unit tests in C#.
Features
- Writing And Executing Tests in C# for Net7.0 and Net8.0
- Convenient interface for running test-suites directly from Godot<br> One of the main features of GdUnit4 is the ability to run test-suites directly from the Godot editor using the context menu. You can run test-suites from the FileSystem panel, the ScriptEditor, or the GdUnit Inspector. To do this, simply right-click on the desired test-suite or test-case and select "Run Test(s)" from the context menu. This will run the selected tests and display the results in the GdUnit Inspector.<br> You can create new test cases directly from the ScriptEditor by right-clicking on the function you want to test and selecting "Create TestCase" from the context menu.
- Fluent Syntax for writing test cases that's easy to read and understand
- Wide range of Assertions for verifying the behavior and output of your code
- Test Fuzzing support: for generating random inputs to test edge cases and boundary conditions
- Parameterized Tests: (Test Cases) for testing functions with multiple sets of inputs and expected outputs
- Dynamic Tests Data: 'DataPoint' attribute to define test data sets
- Scene runner: for simulating different kinds of inputs and actions, such as mouse clicks and keyboard inputs<br> For example, you can simulate mouse clicks and keyboard inputs by calling the appropriate methods on the runner instance. Additionally, you can wait for a specific signal to be emitted by the scene, or you can wait for a specific function to return a certain value.
- GdUnit4.Analyzer: is a Roslyn-based analyzer package designed to enhance the development experience when writing tests with GdUnit4. It provides compile-time validation for GdUnit4 test attributes and helps developers catch configuration errors early in the development process.
Short Example
namespace GdUnit4.Tests
{
using static Assertions;
[TestSuite]
public class StringAssertTest
{
[TestCase]
public void IsEqual()
{
AssertThat("This is a test message").IsEqual("This is a test message");
}
}
}
You are welcome to
Thank you for supporting my project
Sponsors
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. 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. |
-
net7.0
- CommandLineParser (>= 2.9.1)
- GodotSharp (>= 4.3.0)
- Microsoft.CodeAnalysis (>= 4.9.2)
- Microsoft.CodeAnalysis.CSharp (>= 4.9.2)
- Microsoft.CodeAnalysis.CSharp.Workspaces (>= 4.9.2)
- Moq (>= 4.18.4)
- MSTest.TestFramework (>= 3.1.1)
- Newtonsoft.Json (>= 13.0.3)
-
net8.0
- CommandLineParser (>= 2.9.1)
- GodotSharp (>= 4.3.0)
- Microsoft.CodeAnalysis (>= 4.9.2)
- Microsoft.CodeAnalysis.CSharp (>= 4.9.2)
- Microsoft.CodeAnalysis.CSharp.Workspaces (>= 4.9.2)
- Moq (>= 4.18.4)
- MSTest.TestFramework (>= 3.1.1)
- Newtonsoft.Json (>= 13.0.3)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on gdUnit4.api:
Package | Downloads |
---|---|
gdUnit4.test.adapter
GdUnit4 Test Adapter is the test adapter to run GdUnit4 tests in C#. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
4.4.0-rc6 | 643 | 11/11/2024 | |
4.4.0-rc5 | 470 | 11/6/2024 | |
4.4.0-rc4 | 66 | 11/5/2024 | |
4.4.0-rc3 | 227 | 10/31/2024 | |
4.4.0-rc2 | 291 | 10/28/2024 | |
4.3.1 | 7,311 | 7/30/2024 | |
4.3.0 | 1,362 | 7/9/2024 | |
4.2.5 | 5,606 | 6/24/2024 | |
4.2.4 | 805 | 6/4/2024 | |
4.2.4-rc3 | 580 | 5/1/2024 | |
4.2.4-rc2 | 200 | 4/27/2024 | |
4.2.4-rc1 | 421 | 4/25/2024 | |
4.2.3 | 2,791 | 4/17/2024 | |
4.2.2 | 603 | 4/12/2024 | |
4.2.1.1 | 791 | 3/10/2024 | |
4.2.1 | 1,023 | 2/24/2024 | |
4.2.0-rc.202402222030 | 1,923 | 2/22/2024 | |
4.2.0-rc.202402212033 | 107 | 2/21/2024 | |
4.2.0-rc.202312021729 | 3,249 | 12/2/2023 |
v4.4.0-rc*
Improvements:
* GD-46: Added support of DataPoint attributes, which make it possible to define parameterized tests with dynamic test data
* GD-138: Added capture test case execution stdout to the test report if `CaptureStdOut` is enabled
* GD-140: Code cleanup and fix formatting, fix warnings
* GD-144: Added AwaitInputProcessed to SceneRunner
* GD-153: Add Roslyn Analyzer to validate TestCase and DataPoint attribute combinations
* GD-156: Add an exception hook to report exceptions as test errors that are normally caught and hidden by Godot
-------------------------------------------------------------------------------------------------------
v4.3.1
Bug Fixes:
* GD-135: Cannot test signals on non-node classes
-------------------------------------------------------------------------------------------------------
v4.3.0
Improvements:
* GD-127: Replace stdout based TestEventProcessor by IPC implementation
* GD-124: Use LaunchProcessWithDebuggerAttached instead of AttachDebuggerIfNeed for Rider 2024.2
-------------------------------------------------------------------------------------------------------
v4.2.5
Bug Fixes:
* GD-110: Allow a Node to be passed in to SceneRunner.Load as the root of the scene.
* GD-121: Improve AssertSignal by adding a StartMonitoring method
-------------------------------------------------------------------------------------------------------
V4.2.4
Improvements:
* GD-89: Add input action support to the `SceneRunner` by @MikeSchulze in https://github.com/MikeSchulze/gdUnit4Net/pull/92
- Added input action handling to the SceneRunner
- `SimulateActionPressed(string action)`
- `SimulateActionPress(string action)`
- `SimulateActionRelease(string action)`
* GD-94: Improve assertions error message when comparing objects by @MikeSchulze in https://github.com/MikeSchulze/gdUnit4Net/pull/95
* GD-99: Add support to load a scene by `uid://` path to the Scene Runner by @MikeSchulze in https://github.com/MikeSchulze/gdUnit4Net/pull/100
Bug Fixes:
* GD-90: Cleanup old runner configuration before run new tests by @MikeSchulze in https://github.com/MikeSchulze/gdUnit4Net/pull/93
* GD-96: Fix methods with a single parameterized test case are not executed by @MikeSchulze in https://github.com/MikeSchulze/gdUnit4Net/pull/97
* GD-101: Respect the GdUnit4 settings to notify about orphan nodes by @MikeSchulze in https://github.com/MikeSchulze/gdUnit4Net/pull/102
* GD-103: Trim MSTest assert stack trace by @MikeSchulze in https://github.com/MikeSchulze/gdUnit4Net/pull/105
* GD-104: Fix exception failure message propagation by @MikeSchulze in https://github.com/MikeSchulze/gdUnit4Net/pull/108
-------------------------------------------------------------------------------------------------------
v4.2.3
Bug Fixes:
- Fix `AssertThat` for dynamic assert type resolving
-------------------------------------------------------------------------------------------------------
v4.2.2
What's Changed:
- Rename repository from `gdUnit4Mono` to `gdUnit4Net`
- Update project to GodotSharp v4.1.0
- Format and fix warnings according to C# standards
- Format the tests according to the C# Formatting rules
- Format the code to C# standard
- Support both net7 and net8 at once
- Add full .NET8 support
- Provide generic vector assert to support all Godot vector types
- Revision of the stack trace collection for failed tests
- Complete missing features for `IDictionaryAssert`
- Complete missing features for `IEnumerableAssert`
- Complete missing features for `INumberAssert`
- Add missing `SimulateMouseMoveRelative` and `SimulateMouseMoveAbsolute` to `ISceneRunner`
Bug Fixes:
- SceneRunner: Fix InputEvent handling
- Calling Invoke on `SceneRunner` must propagate exceptions
- Fix GdUnit4MonoAPI `IsTestSuite` cannot run TestSuite
- Fix test run stops at some point
- Parameterized test cases are not run from Godot Editor GdUnit4 inspector
-------------------------------------------------------------------------------------------------------
v4.2.0
- gdUnit4 API initial version.