This version of GdUnit4.api is based on Godot v4.2.2.stable.mono.official [15073afe3] (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.
- Writing, executing and debugging tests
- Configurable template for generating new test-suites when creating test-cases
- 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
There are two packages you need to install
- gdUnit4.api is the package to enable GdUnit4 to write unit tests in C#.
- gdUnit4.test.adapter is the GdUnit4 Test Adapter, designed to facilitate the integration of GdUnit4 with test frameworks supporting the Visual Studio Test Platform.
Checkout the readme to install the gdunit4.api
package.
Checkout the readme to install the gdunit4.test.adapater
package.
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!