-
Notifications
You must be signed in to change notification settings - Fork 105
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
Await in Pre-Run Hook Script #670
Comments
I think this is a good addition. This should probably also be done for the post-run script. And maybe Great use of the Awaiter. Always happy to see some internal piece of GUT get reused. You could move the func run():
var awaiter = GutUtils.Awaiter.new()
gut.add_child(awaiter)
...
awaiter.queue_free() If it becomes annoying to wait for the server when you don't need it, you could move your server check logic into the This would require adding an You could implement extends GutTest
class_name MultiplayerTest
func should_skip_script():
...
await wait_for_signal(multiplayer_tester.connected, 10)
return not multiplayer_tester.is_connected_to_server() |
These are great ideas. I'll do this instead. Thank you for suggest this. |
Versions
What versions of Godot do you want to use this feature in?
4.x
The Feature
I would like the ability to await in the pre-run hook script, meaning, you can halt the execution of the tests until something happens. I don't know if this is already possible or not, but from what I could tell, it doesn't seem like you can do this. Correct me if i'm wrong.
So here's a use case example of why I think this could be useful, and it applies to the game project I'm currently working on. My game is multiplayer, so some of my tests require a multiplayer connection. I've created a test server that responds to requests from a test client. The client runs the tests. It sends requests to the server. The server receives the requests and does stuff that's related to the test that the client is currently running. Server sends results back to the client. Client runs asserts on the results. That's the short of what i'm doing.
I try to spin up my test server in the pre-run hook script, but here's the problem. I don't want to run my tests until a connection has been established with the test server. This is to prevent the possibility that a test is ran that requires a multiplayer connection before a connection has even been established. For that reason, I want to be able to pause before the tests are ran so that there is time for a connection to be made. Additionally, if for whatever reason, connection to the test server has failed, I want to be able to abort the tests using
abort()
The text was updated successfully, but these errors were encountered: