The latest version of GdUnit4 (master branch) is based on Godot v4.4.dev2.official [97ef3c837]
GdUnit4 Version | Godot minimal required/compatible Version |
---|---|
v4.4.0+ | v4.2.0, v4.3, v4.4.dev2 |
v4.3.2+ | v4.2.0, v4.3 |
v4.3.0, v4.3.1 | v4.2.0 |
v4.2.1-v4.2.5 | v4.1.0 |
v4.2.0 and older | v4.0 |
Gd(Godot)Unit(Unit Testing)4(Godot 4.x)
GdUnit4 is an embedded unit testing framework designed for testing Gd scripts, C# scripts, and scenes in the Godot editor. With GdUnit4, you can easily create and run unit tests to verify the functionality and performance of your code, ensuring that it meets your requirements and specifications.
GdUnit4 is a powerful tool that supports Test-Driven Development (TDD), a popular software development approach that emphasizes creating automated tests before writing any code. By using GdUnit4 for TDD, you can ensure that your code is thoroughly tested and free of bugs, which can save you time and effort in the long run.
- Writing And Executing Tests in GdScript or C#
- Embedded Test Inspector in Godot for easy navigation of your test suites
- Test Discovery, searches for tests at runtime and automatically adds them to the inspector.
- Convenient Interface for running test-suites directly from Godot
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.
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
- Configurable Template for generating new test-suites when creating test-cases
- Wide range of Assertions for verifying the behavior and output of your code
- Argument matchers for verifying that a function call was made with the expected arguments
- Test Fuzzing for generating random inputs to explore edge cases and boundary conditions
- Parameterized Tests for validating functions with multiple sets of inputs and expected outputs
- Mocking classes to simulate behavior and define output for specific functions
- Spy feature for verifying that a function was called with the expected parameters
- Mocking and Spying on Scenes to simulate behavior and verify that certain functions were called
- 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. - Automatic Update Notifier to install the latest version of GdUnit from GitHub
- Commandline Tool for running tests outside of Godot editor
- Flaky Test Handling and Detection
Detects flaky tests by rerunning tests that fail. This feature helps identify non-deterministic or intermittent failures in your test suite. Configure the number of retries and mark flaky tests in the test results. - Continuous Integration Support
- Command line tool for running tests outside of Godot editor
- Generates HTML report
- Generates JUnit XML report
- GitHub Action Integration
A public marketplace action for integrating GdUnit4 into your CI workflow gdunit4-action - GdUnit4Net the C# API
- Support for writing tests in C# gdUnit4.api
- Supporting for the Visual Studio Test Platform to run and debug tests gdunit4.test.adapter
class_name GdUnitExampleTest
extends GdUnitTestSuite
func test_example():
assert_str("This is a example message")\
.has_length(25)\
.starts_with("This is a ex")
- Give Feedback on the gdUnit GitHub Discussions page.
- Suggest Improvements by creating a new feature request issue on the gdUnit GitHub Issues page.
- Report Bugs by creating a new bug report issue on the gdUnit GitHub Issues page.
GdUnit is comprehensively tested to ensure robust functionality.
Continuous Integration (CI) is in place for every pull request to prevent any potential functionality issues.
🙏 Special Thanks to @Scony for creating gdlint, a valuable tool contributing to code quality.
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!
miguel a.k. bitbrain Sebastian Hutter Rafael Guerreiro Sven Teigler