GUT is a unit testing framework that allows you to write tests for your GDScript in GDScript.
GUT is compatible with all versions of Godot 4. A full list of releases and Godot version compatibility can be found in the repo README: https://github.com/bitwes/Gut/blob/main/README.md
Features
- Easily execute a single test, inner class, full script, or the entire suite with context sensitive buttons, menus, and keyboard shortcuts.
- A plethora of asserts and utility methods to help make your tests simple and concise.
- Setup/teardown, and pre/post run hooks.
- Doubling (mocking): Full and Partial, Stubbing, Spies.
- Parameterized Tests.
- Singleton (i.e
Input,OS,Time) doubling. - Engine error detection and "handling" via Error Tracking.
- Orphan tracking and detailed orphan lists to help track down memory leaks.
- Support for Inner Test Classes to give your tests some extra context and maintainability.
- Export results in standard JUnit XML format.
Multiple ways to run tests
- Run tests directly through the editor, with or without the debugger active.
- Command Line Interface (CLI).
- VSCode extension for running your tests.
Getting Started
extends GutTest
func before_all():
gut.p("ran run setup")
func before_each():
gut.p("ran setup")
func after_each():
gut.p("ran teardown")
func after_all():
gut.p("ran run teardown")
func test_passes():
# this test will pass because 1 does, in fact, equal 1
assert_eq(1, 1)
func test_fails():
# this test will fail because those strings are not equal
assert_eq('this does not', 'equal that')
Changelog for version v9.7.1
No changelog provided for this version.
Reviews
IMO, This addon is a must-have for any non-trivial project. Writing tests can be a bit annoying at first, but you'll thank yourself as your project grows and becomes more difficult to manage.
Helpful! Well-documented! Easy and pleasant to use! Quick updates!
Don't use this for your prototype, but if you are expecting +6months into development, consider using this addon to avoid repeating manually tests. Remember, your future self at 1am will not see those bugs as the code will
Login to write a review.