Releases: bitwes/Gut
Release list
9.7.1
Bug Fixes
- 841 Invalid classes in class list was causing doubles to have parsing errors on some operating systems.
- 842 Ignore "Compiler bug: Unresolved return" errors which can occur when doubles are being generated. The error still appears in the log but GUT will no longer fail tests when it occurs.
- Ported changes from 9.6.1
9.6.1
Features
- 805 Renamed internal classes to make clashes with autoloads and user classes far less likely.
Bug Fixes
- 802 The GUT Panel no longer overlaps with the Editor's center panel tabs when it is at its minimum size.
- 824 Fixed using
assert_no_new_orphansinafter_all. - Various changes to the "Check for update" system.
New Contributors
Full Changelog: v9.6.0...v9.6.1
9.7.0
9.7.0
Breaking Changes
Godot 4.7 introduced more restrictive type checking for return values. In prior releases Doubles could return null regardless of the declared return type of the function. Doubles have been adjusted to return a default value for each TYPE_ constant. This may cause false postives/negatives in existing and new tests if you do not take this into account.
You can find a complete list of the default values at https://gut.readthedocs.io/en/latest/Doubles.html
When a method is stubbed to return an invalid value GUT will generate an error but execution will continue. This will result in an engine error as well.
Gut Error Example:
[GUT ERROR]: Method [explicit_int_return] was stubbed to return invalid value [adsf].
Engine Error Example:
SCRIPT ERROR: Trying to return a value of type "String" from a function whose return type is "int".
stub(...).to_do_nothing() now stubs the method to return the default value for the return type of the function.
Features
- Compatibility changes for Godot 4.7.
Change Log
- Update detection by @bitwes in #815
- updated message, fixed null errors when loading canceled by @bitwes in #817
- clip controls and custom minimum size by @bitwes in #818
- Update gdscript_native_class_names_by_type in GutUtils by @Curtis-Barnhart in #810
- Fix a typo and a grammar mistake in docs by @Mitten-O in #809
- add _to_string to blacklist by @bitwes in #819
- Add documentation for setting global per-test hooks in pre-run hook by @Curtis-Barnhart in #804
- I824 orphans after all by @bitwes in #825
New Contributors
- @Mitten-O made their first contribution in #809
Full Changelog: v9.6.0...v9.7.0
9.6.0
9.6.0
Breaking Changes
assert_push_errorandassert_engine_errornow only accept a string and assert a single error exists with the specified text.assert_push_error_countandassert_engine_error_counthave been added to assert error counts. It was too witty to have the original methods do two things.assert_push_errorandassert_engine_errorwill fail with a message telling you to use the new methods if you pass them a number.
Features
- Compatibility changes for Godot 4.6.
- Added
assert_push_warningandassert_push_warning_count. Calls topush_warningno longer cause tests to fail due to unexpected errors (#775). - Added
print_tracked_errorsthat will print all errors that were generated by the test. - Added the ability to double Godot Singletons (
Input,Time,OS, etc.). See https://gut.readthedocs.io/en/latest/Doubling-Singletons.html for more information. - When running headless, GUT will automatically ignore all calls to
pause_before_teardownand will exit when tests are finished (in case your forget to specify-gignore_pauseand-gexit). - You can now get the amount of time that has passed for a test via the new methods
get_elapsed_sec,get_elapsed_msec,get_elapsed_usec,get_elapsed_idle_frames,, get_elapsed_process_frames, andget_elapsed_physics_frames.
What's Changed
- fix error calling get_base_script on null instance for non-script files by @ThunderFD in #765
- Add abstract class/method support by @namelessvoid in #763
- Docstrings and type hints for junit_xml_export and strutils by @Curtis-Barnhart in #711
- I775 push warning by @bitwes in #778
- Track Test's Elapsed Time by @Curtis-Barnhart in #769
- Singleton doubling by @bitwes in #782
- Add missing terminal quote in doc comment by @namelessvoid in #791
- Godot 4 6 by @bitwes in #808
- Add documentation for Registering inner classes in pre-run hook by @Curtis-Barnhart in #806
- Add support for anonymous functions to assert_connected by @Curtis-Barnhart in #793
- #780 Using
SceneTree.change_scene_to_fileor the other change scene methods in a test no longer break things when running from the editor.
New Contributors
- @ThunderFD made their first contribution in #765
- @namelessvoid made their first contribution in #763
Full Changelog: v9.5.0...v9.6.0
9.5.0
9.5.0
Here's a quick video covering some new features: https://www.youtube.com/watch?v=ovq_1sjIpOs
Breaking Changes
- Stubbing/Doubling/Spying on vararg methods has changed (due to engine changes).
- You no longer need to stub the parameter count for vararg methods.
- Since you don't need to do that, you can't do that anymore.
- Asserting parameter values passed into a vararg must be enclosed in an array.
assert_called(my_double.rpc_id, [p1, p2, [vararg_val1, vararg_val2, vararg_val3]])- Test scripts are now freed after they finish. Prior to this release they would continue to exist until the end of the run, but were removed from the tree. This has been changed to give more accurate orphan information and because it wasn't needed anymore. You shouldn't care, but I thought you should know.
Features
- Requires Godot 4.5
- New menu and functionality at Project->Tools->GUT
- All the
.uidfiles you could ever want. - Error detection and asserts have been added. Tests fail when unexpected errors occur and you can assert that errors have occurred (preventing failures). See the wiki for more information.
- Orphaned nodes are now displayed...not the count (well, the count too), but the actual node and some extra information. Insead of seeing "2 new orphans" you'll see something like:
* test_this_makes_two_orphans
2 Orphans:
* test_two_one:<Node#59760445195>
* test_two_two:<Node#59777222412>
* test_with_some_nodes_with_children
9 Orphans
* parent_one:<Node#65062045712> + 5
* parent_a:<Node#65162709014> + 2- Pop out the GUT panel into a window (a.k.a. Make Flaoting). You an also put the text pane below the tree pane when in a window.
- "Awaiting" messages now have a configurable delay which defaults to .5 seconds. Messages to indicate a call to a
wait_method will not appear until this delay has expired. Now your 10 frame awaits aren't noisy unless you want them to be. - More shortcuts, use shortcuts anytime (even if the GUT panel is hidden).
- All GUT dialogs remember their size.
- Run tests externally through the editor. This is basically the same thing as running from the command line, but kicked off through the editor. This was introduced to allow you to run tests that had errors in them without invoking the debugger, but could have many other use cases. See the run-externally options for more information about best use.
- There's an About box now. It has text, and links, and an icon...and absolutely nothing else.
What's Changed
- Check if object emitting signal exist before disconnecting by @m-radzikowski in #726
- updated readme by @bitwes in #727
- Godot 4 4 by @bitwes in #728
- I 725 by @bitwes in #729
- fix: register_inner_classes can handle cyclic dependencies by @thephilipquan in #750
- Godot 4 5 by @bitwes in #760
New Contributors
- @m-radzikowski made their first contribution in #726
- @thephilipquan made their first contribution in #750
Full Changelog: v9.4.0...v9.5.0
9.4.0
9.4.0
Potentially Breaking Changes
- The deprecated
wait_framesand the newwait_idle_frames,wait_physics_framesnow count frames when theSceneTree.process_frameandSceneTree.physics_framesignals are emitted. This may cause some of your awaits to wait a frame too long/short. This approach is more reliable as it occurs before the_processor_physics_processis called on anything in the tree. This means that tree order will not matter and all objects will have finished_process/_physics_processby the time the await ends.
Features
- Utilized the adapted Godot tools that generate HTML from code comments, moving some documentation to code comments. This makes more documentation easily accessible from the editor and cuts down on some duplicate documentation.
wait_idle_framesadded. This counts frames idle/process frames instead of_physics_process.wait_frameshas been renamed (deprecated) towait_physics_frames.wait_whileadded. This waits while aCallablereturnstrue.- New
class_names:GutInputFactoryforres://addons/gut/gut_input_factory.gdstatic class.
- Signal related methods now accept a reference to a signal as well as an object/signal name:
get_signal_emit_count,assert_connected,assert_not_connected,assert_signal_emitted,assert_signal_not_emitted,assert_signal_emitted_with_parameters,assert_signal_emit_count,get_signal_parameters.
Deprecations
wait_frameshas been deprecated in lieu of the more specificwait_physics_framesandwait_idle_frames.
Changelog
- I192 in just under 5 years I moved the two lines of code up some to finally fix this.
- Remove editor config file warning by @bitwes in #682
- add default title to assert_not_freed by @bitwes in #683
- I639 by @bitwes in #684
- Gut test comments by @bitwes in #685
- Fix docs typo by @Curtis-Barnhart in #692
- include parameter list in passing test message by @bitwes in #698
- fixed issue by @bitwes in #699
- Refactor wait methods by @bitwes in #701
- I630 wait while by @bitwes in #703
- Add instructions for installing gut as a git submodule by @Curtis-Barnhart in #695
- Wrap failure and pending messages with CDATA by @bitwes in #707
- fix failing test_optparse.TestValuesDictionary test by @Curtis-Barnhart in #704
- add hold_frams and hold_seconds to input sender by @bitwes in #712
- Clear embedded font from OutputText.tscn by @gbrock in #713
- Optparse option aliases by @Curtis-Barnhart in #705
- Fix typo in the Awaiting documentation by @pupeno in #714
- Avoid global
Loggeras this conflicts with a native class in Godot 4.5 by @dreed-sd in #715 - Pass signals instead of strings by @bitwes in #717
New Contributors
- @Curtis-Barnhart made their first contribution in #692
- @gbrock made their first contribution in #713
- @pupeno made their first contribution in #714
- @dreed-sd made their first contribution in #715
Full Changelog: 9.3.1...v9.4.0
v9.3.1
9.3.1
A small collection of bug fixes and documentation. GUT can now generate documentation from code comments.
Features
- added class_name to InputSender by @bitwes in #651
- add await in pre-run script, post-run scrpt, and should_skip_script. by @LowFire in #671
- Doctools generation by @bitwes in #672
Bug Fixes
- Parsed Native Refcounted Objects are not freed. by @bitwes in #648
- Housekeeping by @bitwes in #652
- I650 more warnings by @bitwes in #653
- fix: Mocking-Input link by @HotariTobu in #659
- Fixed typos in error messages. by @xmoby in #663
- Fix docs typo by @MSWS in #665
- Font import files: Add disable_embedded_bitmaps by @manuq in #674
- Update is_almost_eq() to use built-in vector comparison by @onegm in #668
New Contributors
- @HotariTobu made their first contribution in #659
- @xmoby made their first contribution in #663
- @MSWS made their first contribution in #665
- @LowFire made their first contribution in #671
- @manuq made their first contribution in #674
- @onegm made their first contribution in #668
Full Changelog: v9.3.0...9.3.1
v9.3.0
9.3.0
Features
- You can Monkey Patch your doubles! You can make any method in a double call a specified
Callableusing.to_call(callable)onstub. Details are on the Stubbing wiki page.
var dbl = double(MyScript)
stub(dbl.some_method).to_call(func(): print("Monkey Patched!"))- You can now use callables to
stubinsetad of passing the object and method name. Binding arguments adds an implicitwhen_passedto the stub. Less strings, less typing!
var dbl = double(MyScript)
# same as stub(dbl, "some_method").to_return(111)
stub(dbl.some_method).to_return(111)
# same as stub(dbl, 'some_method').to_return(999).when_passed("a")
stub(dbl.some_method.bind("a")).to_return(999)- @WebF0x GUT can now wait on a
Callableto returntrue(aka predicate method) via the newwait_until:
# Call the function once per frame until it returns 5 or one second has elapsed.
await wait_until(func(): return randi_range(0, 20)==5, 1)
wait_for_signaland the newwait_untilreturntrueif they did not timeout, andfalseotherwise. This means waiting on, and asserting a signal has been emitted can now be written as
assert_true(await wait_for_signal(my_obj.my_singal, 2),
'signal should emit before 2 seconds')
- @mphe GUT now automatically enables the "Exclude Addons" option when running tests. This means you don't have to keep enabling/disabling this option if GUT does not conform to your warning/error settings.
- GUT disables warnings at key points in execution and then re-enables them. This makes running GUT possible (or at least easier) with warning levels incompatable with GUT source code. This also makes the ouput less noisy.
- @plink-plonk-will Elapsed time is now included in the XML export.
- Issue #612
InputSendernow sets thebutton_maskproperty for generated mouse motion events when mouse buttons have been pressed but not released prior to a motion event. - Issue #598 Added the virtual method
should_skip_scripttoGutTest. If you impelement this method and returntrueor aString, then GUT will skip the script. Skipped scripts are marked as "risky" in the final counts. This can be useful when skipping scripts that should not be run under certiain circumstances such as:- You are porting tests from 3.x to 4.x and you don't want to comment everything out.
- Skipping tests that should not be run when in
headlessmode.
func should_skip_script(): if DisplayServer.get_name() == "headless": return "Skip Input tests when running headless"
- If you have tests that would normally cause the debugger to break on an error, you can skip the script if the debugger is enabled so that the run is not interrupted.
func should_skip_script(): return EngineDebugger.is_active()
- The CLI got an update to its Option Parser. There's more info in #623:
- options that take a value can now be specified with a space (
option value) instead of usingoption=value. -ghoption now has headings for the different options. It looks a lot better.-gdirand-gtestcan be specified multiple times instead of using a comma delimited list.- You can use
-gconfig=to not use a config file.
- options that take a value can now be specified with a space (
- Minor niceties such as showing that GUT is exiting in the title bar (takes a bit sometimes) and switching to full display at the end of a run if GUT does not automatically exit.
Bug Fixes
- Issue #601 doubles now get a resource path that makes Godot ignore them when "Exclude Addons" is enabled (res://adddons/gut/not_a_real_file/...).
- Issue #594 An error is generated if GUT cannot find the double template files. This can happen if you export your game with tests, but do not include *.txt files.
- Issue #595 When no tests are run GUT no longer displays "All Tests Passed!" and exits (based off of settings).
- Issue #578 Fix
InputSenderso it works withInput.is_action_just_pressed,Input.is_action_just_releasedandInput.is_action_pressed. Thanks @lxkarp and @edearth for you work on this.
Deprecations
- The optional
GutTestscript variableskip_scripthas been deprecated. Use the newshould_skip_scriptmethod instead. - GUT now warns if you have overridden
_readyin your test script without callingsuper._ready.
New Contributors
- @mphe made their first contribution in #600
- @plink-plonk-will made their first contribution in #581
- @nycdotnet made their first contribution in #617
- @WebF0x made their first contribution in #609
- @lxkarp made their first contribution in #587
- @Edearth made their first contribution in #634
Full Changelog: v9.2.1...v9.3.0
v9.2.1
What's Changed
- Issue #570 Doubling scripts that contain a statically typed variable of another class_name script (
var foo := Foo.new()where foo is aclass_namein another script) could cause errors. - Add support for running tests through the debugger via VSCode via the gut-extension.
Full Changelog: v9.2.0...v9.2.1