- GDScript 92.8%
- GAP 4.3%
- HTML 1.2%
- CSS 0.7%
- C# 0.6%
- Other 0.4%
| addons/gdUnit4 | ||
| scenes | ||
| scripts | ||
| test | ||
| .editorconfig | ||
| .gitattributes | ||
| .gitignore | ||
| <null> | ||
| ABILITY_REVIEW.md | ||
| CLAUDE.md | ||
| COMPLETE_FIX_SUMMARY.md | ||
| DEBUG_FINDINGS.md | ||
| DEBUG_INSTRUCTIONS.md | ||
| ERROR_ANALYSIS.md | ||
| FIXES_FOR_END_TO_END.md | ||
| Gdmut.csproj | ||
| Gdmut.csproj.old | ||
| Gdmut.sln | ||
| icon.svg | ||
| icon.svg.import | ||
| image.png | ||
| image.png.import | ||
| LICENSE | ||
| PLAYTEST_SETUP.md | ||
| PLAYTEST_SUMMARY.md | ||
| project.godot | ||
| README.md | ||
| rules.txt | ||
| sample_game.txt | ||
| test_int_errors.txt | ||
| TEST_REVIEW.md | ||
| TestClass.cs | ||
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.
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
- Press the build button before enabling the plugin. This is to allow the plugin to build the necessary files to run.
- Ensure the plugin is enabled in the Godot editor.
- In a script, write a test function. Test functions must be static, parameterless, be prepended with the
[CSTestFunction]attribute, and return aResulttype, indicating it's success or failure.- If an exception is thrown in your function, it will be counted as a fail.
- Open the "C# Testing" ui on the editor (it should be on the right by default).
- Click "Load Tests". This should populate the dock with a list of all your test functions and the types that they reside in.
- 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 testsTest filtering (filter by name which tests to run)- Parameterized functions
- Async functions
