-
-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GD-154: Add new assert_func
with a wait_until(<time>)
to wait for a specific return value
#159
Conversation
…pecific return value
Mhh, it sure works. But I think it doesn't really integrate well into the scene runner, which would allow you to run scenes at faster speeds. So now I need to decide if I want to have a timed assert or a faster run, I can't have both currently. If I use the scene runner, I need a signal or simulate a certain amount of frames, but cannot wait for a condition to be true. If I use the new assert, I can only run at normal speed. I think the separation of the scene runner and asserts doesn't help a lot with integration tests. In integration tests you very often have to wait on a certain thing to happen and this wait almost always also serves as an assert (because if the thing doesn't happen, the next thing usually makes no sense to run anyways). I wonder if this could be solved by having two classes for two types of tests. I would argue that you will need the runner in integration tests, only but not in unit tests. So you could have class_name SomeIntegrationTest
extends GdIntegrationTestSuite
var _scene
var _driver
func before_test():
_scene = load(..).instance()
_driver = GameDriver.new()
# this would be the equivalent of creating a new scene runner
# it would be a function of the new GdIntegrationTestSuite class
attach_scene(scene)
# run everything at 3x speed
set_time_factor(3)
# set a default timeout for all timed assertions
set_default_assertion_timeout(3000)
func after_test():
# would free the scene node so next test starts with a fresh one
free_scene()
func test_something():
# when
simulate_mouse_click(...)
# then
# wait until a dialog is shown
yield(assert_func(_driver.some_dialog, "is_present").is_true())
# abort test if an error occurred
if has_error():
return
# when
_driver.car.move()
# then
# wait until the car sends the "crashed" signal.
yield(assert_signal(_driver.car.get(), "crashed").is_sent())
Of course this is a breaking change 😢 I'm sorry I didn't think of this earlier. |
Thanks for your feedback. The new For integrate integration tests stuff i will create a new feature request. |
to continue i will provide a function on the SceneRunner where at least wraps around the |
- still problems with orphan nodes
No description provided.