This version of GdUnit4.api is based on Godot v4.3.stable.mono.official [77dcf97d8] (master branch)
This project provides an API and a VS test adapter to run your Godot C# test in Visual Studio (Code) and JetBrains Rider.
|
ADVICE The documentation references version 4.4.0, which is not yet officially released. This is intentional as these changes will be part of the upcoming 4.4.0 release. |
- Writing, executing and debugging tests
- Wide range of assertion methods for verifying the behavior and output of your code
- Parameterized Tests (Test Cases) for testing functions with multiple sets of inputs and expected outputs
- Scene runner for simulating different kinds of inputs and actions, such as mouse clicks and keyboard inputs
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. - Visual Studio Test Adapter to run and debug your tests
- Powerful test filtering capabilities to selectively run tests based on various criteria
There are three packages available in this project:
- gdUnit4.api - The core package to enable writing and running unit tests in C#.
- gdUnit4.test.adapter - The test adapter to integrate GdUnit4 with Visual Studio Test Platform.
- gdUnit4.analyzers - A Roslyn-based analyzer that provides compile-time validation for GdUnit4 test attributes.
Checkout the gdUnit4.api README to install and use the core testing framework.
Checkout the gdUnit4.test.adapter README to install and use the test adapter. This adapter now supports powerful test filtering capabilities for selectively running tests based on specific criteria.
For compile-time validation of your test code, check out the gdUnit4.analyzers README.
This example project gives you a short insight into how to set up a Godot project to use the GdUnit4 API and test adapter. It contains a single test suite as an example with two tests, the first test will succeed and the second test will fail.
namespace Examples;
using GdUnit4;
using static GdUnit4.Assertions;
[TestSuite]
public class ExampleTest
{
[TestCase]
public void success()
{
AssertBool(true).IsTrue();
}
[TestCase]
public void failed()
{
AssertBool(false).IsTrue();
}
}
The test run looks like this.
- Give Feedback
- Suggest Improvements
- Report a Bug related to GdUnit4 API
- Report a Bug related to GdUnit4 Test Adapter
Thank you for your interest in contributing to GdUnit4!
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!
This project is licensed under the MIT License - see the LICENSE file for details.