Automated test for Bevy through BRP#23647
Conversation
3679862 to
0e1f61c
Compare
0e1f61c to
6750aa1
Compare
There was a problem hiding this comment.
I see the value in these examples as is (to demonstrate manipulating a live-app for testing purposes), but I wonder if these examples could be made more compelling by exploring it from the prospective of an app creator attempting to incorporate automated tests into their project.
For example, it might be helpful to setup how this could look if someone wants to have these automated tests run in CI by giving an example GitHub Action config or something alongside (although something like that might probably be in the works for this repo itself?, in which case I would just express that such a setup may be useful to share with app creators as well!).
I’m also not sure if the phrase “Automated Test” sounds too vague for what this is. I would liken this to an “(End-to-end?) Integration Test" since it tests running a whole app.
| //! Run with the `bevy_remote` feature enabled: | ||
| //! ```bash | ||
| //! cargo run --example app_under_test --features="bevy_remote" | ||
| //! ``` |
There was a problem hiding this comment.
Just to link back to the other example in some way optionally
| //! ``` | |
| //! ``` | |
| //! This example can be paired with the `automated_test` example, which will run an automated | |
| //! test on this app. |
|
|
||
| fn move_button(mut rng: ResMut<SeededRng>, mut button_query: Query<&mut Node, With<Button>>) { | ||
| let (left_pct, top_pct) = random_position(&mut rng.0); | ||
| info!("Button moved to ({left_pct:.1}%, {top_pct:.1}%)"); |
There was a problem hiding this comment.
nit: I think the example could be more compelling if these print statements were in logical coordinates to match what’s going on in automated_test so the viewer sees numbers match
| fn main() { | ||
| App::new() | ||
| .add_plugins(DefaultPlugins) | ||
| .add_plugins(RemotePlugin::default()) |
There was a problem hiding this comment.
| .add_plugins(RemotePlugin::default()) | |
| // To make the app available for automated testing, we add these | |
| // remote plugins to expose API’s for a testing framework to call. | |
| .add_plugins(RemotePlugin::default()) |
Objective
Solution
WindowEventso that it goes through the whole of BevyTesting