Check out our latest project ✨ OpenChapter.io: free ebooks the way its meant to be πŸ“–

GDMUT - C# Unit Tester

An asset by spycemyster
The page banner background of a mountain and forest
GDMUT - C# Unit Tester thumbnail image
GDMUT - C# Unit Tester thumbnail image
GDMUT - C# Unit Tester thumbnail image
GDMUT - C# Unit Tester hero image

Quick Information

0 ratings
GDMUT - C# Unit Tester icon image
spycemyster
GDMUT - C# Unit Tester

A Blazingly Fast and Simple C# Unit Testing Framework for Godot. Easy to setup and use. See the Github link to see how to setup and use the tool. Please note that this is early in development. Breaking changes may be introduced in the future.Feel free to leave any feedback or bugs on the issues section!

Supported Engine Version
4.2
Version String
1.0.0
License Version
MIT
Support Level
community
Modified Date
1 year ago
Git URL
Issue URL

GDMUT

A unit testing framework for C# scripts in Godot. See the Godot Asset Page Here: https://godotengine.org/asset-library/asset/2100

Features

Blazingly Fast πŸš€

Optimized and multithreaded to allow you to run your tests at blazingly fast speeds! πŸ”₯πŸš€

Visual

A minimal and simple user-interface that displays all the unit tests and results all in a single dock.

README ui

Filtering

Sometimes you might just want to run a certain set of tests. That's now possible with the filter option. Include a filter to match whatever tests you need to run.

Simple To Use

Minimal overhead added to create unit tests. Declare a unit test function by adding a [CSTestFunction] onto a static, parameterless function with a Result return type. After that, you can load and run your tests effortlessly.

How to Use

  1. Press the build button before enabling the plugin. This is to allow the plugin to build the necessary files to run.
  2. Ensure the plugin is enabled in the Godot editor.
  3. In a script, write a test function. Test functions must be static, parameterless, be prepended with the [CSTestFunction] attribute, and return a Result type, indicating it's success or failure.
    • If an exception is thrown in your function, it will be counted as a fail.
  4. Open the "C# Testing" ui on the editor (it should be on the right by default).
  5. Click "Load Tests". This should populate the dock with a list of all your test functions and the types that they reside in.
  6. Click on "Run Tests" to run each of the tests.

Example Test Functions

using GdMUT;

/// <summary>
/// This is a test class for GDMUT. This is purely for demonstration. If you added
/// this into your project, feel free to delete it =)
/// </summary>
public class TestClass
{
    #if TOOLS
    [CSTestFunction]
    public static Result ExamplePass()
    {
        int x = 0;
        x *= 100;
        return (x == 0) ? Result.Success : Result.Failure;
    }

    [CSTestFunction]
    public static Result ExampleFail()
    {
        int x = 0;
        x *= 100;
        return (x != 0) ? Result.Success : Result.Failure;
    }

    [CSTestFunction]
    public static Result ExampleCustomFail()
    {
        int x = 0;
        x *= 100;
        return (x != 0)
            ? Result.Success
            : new Result(false, "You can't multiply 0 and expect anything else than 0!");
    }

    [CSTestFunction]
    public static Result ExampleCustomSuccess()
    {
        int x = 0;
        x *= 100;
        return (x == 0) ? new Result(true, "Proved that 0 * 100 = 0") : Result.Failure;
    }
    #endif
}

NOTE: The '#region' and '#if TOOLS' preprocessor directives are optional. Just good practice :)

Planned Features

  • Multithreaded tests
  • Test filtering (filter by name which tests to run)
  • Parameterized functions
  • Async functions

A Blazingly Fast and Simple C# Unit Testing Framework for Godot. Easy to setup and use. See the Github link to see how to setup and use the tool.

Please note that this is early in development. Breaking changes may be introduced in the future.

Feel free to leave any feedback or bugs on the issues section!

Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
GDMUT - C# Unit Tester icon image
spycemyster
GDMUT - C# Unit Tester

A Blazingly Fast and Simple C# Unit Testing Framework for Godot. Easy to setup and use. See the Github link to see how to setup and use the tool. Please note that this is early in development. Breaking changes may be introduced in the future.Feel free to leave any feedback or bugs on the issues section!

Supported Engine Version
4.2
Version String
1.0.0
License Version
MIT
Support Level
community
Modified Date
1 year ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers