Skip to content

Official C# implementation of GDUnit4 - a comprehensive unit testing framework for Godot 4. Features VS/Rider test adapter integration, parameterized tests, scene runners, and extensive assertion methods.

License

Notifications You must be signed in to change notification settings

MikeSchulze/gdUnit4Net

Repository files navigation

The Unit Testing Framework in C# for Godot

This version of GdUnit4.api is based on Godot v4.3.stable.mono.official [77dcf97d8] (master branch)

Supported Godot Versions

What is gdUnit4Net

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.

Main Features

  • 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.

gdunit4.api

Checkout the gdUnit4.api README to install and use the core testing framework.

gdUnit4.test.adapter

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.

gdUnit4.analyzers

For compile-time validation of your test code, check out the gdUnit4.analyzers README.

Example Project

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.


Documentation

How to Install GdUnit

API Documentation

Test Filtering Guide

You Are Welcome To


Contribution Guidelines

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!

Join GdUnit Server

Thank you for supporting my project

Sponsors

Jeff Jeff


License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Official C# implementation of GDUnit4 - a comprehensive unit testing framework for Godot 4. Features VS/Rider test adapter integration, parameterized tests, scene runners, and extensive assertion methods.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages