GutTest
Inherits: Node
This is the base class for all test scripts. Extend this…test the world!
Properties
|
||
|
||
|
||
|
||
|
Methods
add_child_autofree(node, legible_unique_name = false) |
|
add_child_autoqfree(node, legible_unique_name = false) |
|
void |
|
void |
|
void |
assert_accessors(obj, property, default, set_to) |
void |
assert_almost_eq(got, expected, error_interval, text = “”) |
void |
assert_almost_ne(got, not_expected, error_interval, text = “”) |
void |
assert_between(got, expect_low, expect_high, text = “”) |
void |
assert_call_count(inst, method_name, expected_count, parameters = null) |
void |
assert_called(inst, method_name, parameters = null) |
void |
assert_connected(signaler_obj, connect_to_obj, signal_name, method_name = “”) |
void |
assert_does_not_have(obj, element, text = “”) |
void |
assert_eq(got, expected, text = “”) |
void |
assert_eq_deep(v1, v2) |
void |
assert_eq_shallow(v1, v2) |
void |
assert_exports(obj, property_name, type) |
void |
assert_false(got, text = “”) |
void |
assert_file_does_not_exist(file_path) |
void |
assert_file_empty(file_path) |
void |
assert_file_exists(file_path) |
void |
assert_file_not_empty(file_path) |
void |
assert_freed(obj, title = “something”) |
void |
assert_gt(got, expected, text = “”) |
void |
assert_gte(got, expected, text = “”) |
void |
assert_has(obj, element, text = “”) |
void |
assert_has_method(obj, method, text = “”) |
void |
assert_has_signal(object, signal_name, text = “”) |
void |
assert_is(object, a_class, text = “”) |
void |
assert_lt(got, expected, text = “”) |
void |
assert_lte(got, expected, text = “”) |
void |
assert_ne(got, not_expected, text = “”) |
void |
assert_ne_deep(v1, v2) |
void |
assert_ne_shallow(v1, v2) |
void |
assert_no_new_orphans(text = “”) |
void |
assert_not_between(got, expect_low, expect_high, text = “”) |
void |
assert_not_called(inst, method_name, parameters = null) |
void |
assert_not_connected(signaler_obj, connect_to_obj, signal_name, method_name = “”) |
void |
assert_not_freed(obj, title) |
void |
assert_not_null(got, text = “”) |
void |
assert_not_same(v1, v2, text = “”) |
void |
assert_not_typeof(object, type, text = “”) |
void |
assert_null(got, text = “”) |
void |
assert_property(obj, property_name, default_value, new_value) |
void |
assert_property_with_backing_variable(obj, property_name, default_value, new_value, backed_by_name = null) |
void |
assert_readonly_property(obj, property_name, new_value, expected_value) |
void |
assert_same(v1, v2, text = “”) |
void |
assert_set_property(obj, property_name, new_value, expected_value) |
void |
assert_signal_emit_count(object, signal_name, times, text = “”) |
void |
assert_signal_emitted(object, signal_name, text = “”) |
void |
assert_signal_emitted_with_parameters(object, signal_name, parameters, index = -1) |
void |
assert_signal_not_emitted(object, signal_name, text = “”) |
void |
assert_string_contains(text, search, match_case = true) |
void |
assert_string_ends_with(text, search, match_case = true) |
void |
assert_string_starts_with(text, search, match_case = true) |
void |
assert_true(got, text = “”) |
void |
assert_typeof(object, type, text = “”) |
autofree(thing) |
|
autoqfree(thing) |
|
void |
|
void |
|
compare_deep(v1, v2, max_differences = null) |
|
compare_shallow(v1, v2, max_differences = null) |
|
double(thing, double_strat = null, not_used_anymore = null) |
|
void |
fail_test(text) |
get_call_count(object, method_name, parameters = null) |
|
get_call_parameters(object, method_name, index = -1) |
|
get_signal_emit_count(object, signal_name) |
|
get_signal_parameters(object, signal_name, index = -1) |
|
void |
ignore_method_when_doubling(thing, method_name) |
partial_double(thing, double_strat = null, not_used_anymore = null) |
|
void |
pass_test(text) |
void |
|
void |
pending(text = “”) |
void |
register_inner_classes(base_script) |
void |
replace_node(base_node, path_or_node, with_this) |
void |
set_double_strategy(double_strategy) |
void |
simulate(obj, times, delta, check_is_processing: bool = false) |
skip_if_godot_version_lt(expected) |
|
skip_if_godot_version_ne(expected) |
|
stub(thing, p2 = null, p3 = null) |
|
use_parameters(params) |
|
wait_for_signal(sig: Signal, max_wait, msg = “”) |
|
wait_frames(frames, msg = “”) |
|
wait_seconds(time, msg = “”) |
|
wait_until(callable, max_wait, p3 = “”, p4 = “”) |
|
void |
watch_signals(object) |
Deprecated |
void |
assert_setget(instance, name_property, const_or_setter = null, getter = “__not_set__”) |
Deprecated |
double_inner(path, subpath, strategy = null) |
|
Deprecated |
double_scene(path, strategy = null) |
|
Deprecated |
double_script(path, strategy = null) |
|
Deprecated |
yield_for(time, msg = “”) |
|
Deprecated |
yield_frames(frames, msg = “”) |
|
Deprecated |
yield_to(obj, signal_name, max_wait, msg = “”) |
Internal Use |
void |
|
Internal Use |
double_singleton(singleton_name) |
|
Internal Use |
||
Internal Use |
||
Internal Use |
||
Internal Use |
partial_double_singleton(singleton_name) |
|
Internal Use |
run_x_times(x) |
|
Internal Use |
void |
set_logger(logger) |
Constants
EDITOR_PROPERTY = 4102 🔗
No description
VARIABLE_PROPERTY = 4096 🔗
No description
Property Descriptions
No description
Variant DOUBLE_STRATEGY = {"INCLUDE_NATIVE": 0, "SCRIPT_ONLY": 1} 🔗
No description
Variant ParameterFactory = <unknown> 🔗
Reference to addons/gut/parameter_factory.gd script.
Variant InputFactory = <unknown> 🔗
Reference to addons/gut/input_factory.gd script.
Variant InputSender = <unknown> 🔗
Reference to GutInputSender. This was the way you got to the GutInputSender before it was given a class_name
Method Descriptions
Variant should_skip_script() 🔗
No description
void before_all() 🔗
No description
void before_each() 🔗
No description
void after_all() 🔗
No description
void after_each() 🔗
No description
Internal use only.
void set_logger(logger) 🔗
Internal use only.
void assert_eq(got, expected, text = “”) 🔗
No description
void assert_ne(got, not_expected, text = “”) 🔗
No description
void assert_almost_eq(got, expected, error_interval, text = “”) 🔗
No description
void assert_almost_ne(got, not_expected, error_interval, text = “”) 🔗
No description
void assert_gt(got, expected, text = “”) 🔗
No description
void assert_gte(got, expected, text = “”) 🔗
No description
void assert_lt(got, expected, text = “”) 🔗
No description
void assert_lte(got, expected, text = “”) 🔗
No description
void assert_true(got, text = “”) 🔗
No description
void assert_false(got, text = “”) 🔗
No description
void assert_between(got, expect_low, expect_high, text = “”) 🔗
No description
void assert_not_between(got, expect_low, expect_high, text = “”) 🔗
No description
void assert_has(obj, element, text = “”) 🔗
No description
void assert_does_not_have(obj, element, text = “”) 🔗
No description
void assert_file_exists(file_path) 🔗
No description
void assert_file_does_not_exist(file_path) 🔗
No description
void assert_file_empty(file_path) 🔗
No description
void assert_file_not_empty(file_path) 🔗
No description
void assert_has_method(obj, method, text = “”) 🔗
No description
void assert_accessors(obj, property, default, set_to) 🔗
No description
void assert_exports(obj, property_name, type) 🔗
No description
void watch_signals(object) 🔗
No description
void assert_connected(signaler_obj, connect_to_obj, signal_name, method_name = “”) 🔗
No description
void assert_not_connected(signaler_obj, connect_to_obj, signal_name, method_name = “”) 🔗
No description
void assert_signal_emitted(object, signal_name, text = “”) 🔗
No description
void assert_signal_not_emitted(object, signal_name, text = “”) 🔗
No description
void assert_signal_emitted_with_parameters(object, signal_name, parameters, index = -1) 🔗
No description
void assert_signal_emit_count(object, signal_name, times, text = “”) 🔗
No description
void assert_has_signal(object, signal_name, text = “”) 🔗
No description
Variant get_signal_emit_count(object, signal_name) 🔗
No description
Variant get_signal_parameters(object, signal_name, index = -1) 🔗
No description
Variant get_call_parameters(object, method_name, index = -1) 🔗
No description
Variant get_call_count(object, method_name, parameters = null) 🔗
No description
void assert_is(object, a_class, text = “”) 🔗
No description
void assert_typeof(object, type, text = “”) 🔗
No description
void assert_not_typeof(object, type, text = “”) 🔗
No description
void assert_string_contains(text, search, match_case = true) 🔗
No description
void assert_string_starts_with(text, search, match_case = true) 🔗
No description
void assert_string_ends_with(text, search, match_case = true) 🔗
No description
void assert_called(inst, method_name, parameters = null) 🔗
No description
void assert_not_called(inst, method_name, parameters = null) 🔗
No description
void assert_call_count(inst, method_name, expected_count, parameters = null) 🔗
No description
void assert_null(got, text = “”) 🔗
No description
void assert_not_null(got, text = “”) 🔗
No description
void assert_freed(obj, title = “something”) 🔗
No description
void assert_not_freed(obj, title) 🔗
No description
void assert_no_new_orphans(text = “”) 🔗
No description
void assert_setget(instance, name_property, const_or_setter = null, getter = “__not_set__”) 🔗
Deprecated: no longer supported.
void assert_set_property(obj, property_name, new_value, expected_value) 🔗
No description
void assert_readonly_property(obj, property_name, new_value, expected_value) 🔗
No description
void assert_property_with_backing_variable(obj, property_name, default_value, new_value, backed_by_name = null) 🔗
No description
void assert_property(obj, property_name, default_value, new_value) 🔗
No description
void pending(text = “”) 🔗
Mark the current test as pending.
Variant wait_seconds(time, msg = “”) 🔗
Await for the time sent in. The optional message will be printed when the await starts
Variant yield_for(time, msg = “”) 🔗
Deprecated: use wait_seconds
Variant wait_for_signal(sig: Signal, max_wait, msg = “”) 🔗
Yield to a signal or a maximum amount of time, whichever comes first.
Variant yield_to(obj, signal_name, max_wait, msg = “”) 🔗
Deprecated: use wait_for_signal
Variant wait_frames(frames, msg = “”) 🔗
Yield for a number of frames. The optional message will be printed. when Gut detects a yield.
Variant wait_until(callable, max_wait, p3 = “”, p4 = “”) 🔗
No description
Returns whether the last wait_* method timed out. This is always true if the last method was wait_frames or wait_seconds. It will be false when using wait_for_signal and wait_until if the timeout occurs before what is being waited on. The wait_* methods return this value so you should be able to avoid calling this directly, but you can.
Variant yield_frames(frames, msg = “”) 🔗
Deprecated: use wait_frames
Internal use only.
No description
No description
No description
No description
void clear_signal_watcher() 🔗
Internal use only.
Variant get_double_strategy() 🔗
No description
void set_double_strategy(double_strategy) 🔗
No description
void pause_before_teardown() 🔗
No description
Internal use only.
Variant double(thing, double_strat = null, not_used_anymore = null) 🔗
No description
Variant partial_double(thing, double_strat = null, not_used_anymore = null) 🔗
No description
Variant double_singleton(singleton_name) 🔗
Internal use only.
Variant partial_double_singleton(singleton_name) 🔗
Internal use only.
Variant double_scene(path, strategy = null) 🔗
Deprecated: no longer supported. Use double
Variant double_script(path, strategy = null) 🔗
Deprecated: no longer supported. Use double
Variant double_inner(path, subpath, strategy = null) 🔗
Deprecated: no longer supported. Use register_inner_classes + double
void ignore_method_when_doubling(thing, method_name) 🔗
No description
Variant stub(thing, p2 = null, p3 = null) 🔗
No description
void simulate(obj, times, delta, check_is_processing: bool = false) 🔗
No description
void replace_node(base_node, path_or_node, with_this) 🔗
No description
Variant use_parameters(params) 🔗
No description
Internal use only. When used as the default for a test method parameter, it will cause the test to be run x times. I Hacked this together to test a method that was occassionally failing due to timing issues. I don’t think it’s a great idea, but you be the judge. If you find a good use for it, let me know and I’ll make it a legit member of the api.
Marks whatever is passed in to be freed after the test finishes. It also returns what is passed in so you can save a line of code. var thing = autofree(Thing.new())
Works the same as autofree except queue_free will be called on the object instead. This also imparts a brief pause after the test finishes so that the queued object has time to free.
Variant add_child_autofree(node, legible_unique_name = false) 🔗
The same as autofree but it also adds the object as a child of the test.
Variant add_child_autoqfree(node, legible_unique_name = false) 🔗
The same as autoqfree but it also adds the object as a child of the test.
Returns true if the test is passing as of the time of this call. False if not.
Returns true if the test is failing as of the time of this call. False if not.
void pass_test(text) 🔗
Marks the test as passing. Does not override any failing asserts or calls to fail_test. Same as a passing assert.
void fail_test(text) 🔗
Marks the test as failing. Same as a failing assert.
Variant compare_deep(v1, v2, max_differences = null) 🔗
Peforms a deep compare on both values, a CompareResult instnace is returned. The optional max_differences paramter sets the max_differences to be displayed.
Variant compare_shallow(v1, v2, max_differences = null) 🔗
No description
void assert_eq_deep(v1, v2) 🔗
No description
void assert_ne_deep(v1, v2) 🔗
No description
void assert_eq_shallow(v1, v2) 🔗
No description
void assert_ne_shallow(v1, v2) 🔗
No description
void assert_same(v1, v2, text = “”) 🔗
No description
void assert_not_same(v1, v2, text = “”) 🔗
No description
Variant skip_if_godot_version_lt(expected) 🔗
No description
Variant skip_if_godot_version_ne(expected) 🔗
No description
void register_inner_classes(base_script) 🔗
No description