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!
Gran addon. Programar tests unitarios es un trabajo extra importante pero el beneficio de disponer de pruebas automatizadas para tener claro siempre qué es lo que se a roto es muy grande. No todo requiere pruebas unitarias pero para algunas cosas lo veo fundamental. En estos momentos ya estaba haciendo mis escenas de pruebas. Ahora las podré automatizar con este addon y dejarlas ahí que se ejecuten solas cada vez que tenga dudas sobre si habré roto o no algo. Gracias por el addon.
Es un Addon bastante util, facil de usar y ahorra mucho trabajo. El unico problema que he tenido con el es que cada vez que lo instalo en un proyecto (lo he hecho dos veces), da un monton de errores al cargar y tengo que reiniciar Godot hasta que por fin agarra. No se si es un error del plugin o de mi parte, pero cuando agarra es tremenda herramienta, lo recomiendo.
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.