What problem does this solve or what need does it fill?
Make game/project made with bevy as easily testable as possible. It would also help bevy proper since more integration test could be added.
Describe the solution would you like?
I would like to be able to run a bevy app from a #[test] function. In particular, I think it is important to be able to run windowed app.
Describe the alternative(s) you've considered?
- If you only want to check if the code compile, examples could be used. However, that is not really a full testing framework.
- Make a #[bevy::test] attribute that do a bit of the repetitive work of bevy test. Some kind of recommended way of doing thing. I think it is a good idea for the future.
Additional context
I have a working prototype that work for running test on linux with x11. First, let me explain the four problems that I had to solve to make it work.
- Panicking in a bevy app create a nested panic which abort the current process. That prevent the test to continue after the first fail.
- The event_loop used in bevy_init can only be created on the main thread but tests are not run on that thread.
- If you run multiple windowed bevy app simultaneously, window events won't go to the right event loop. That cause a panic when receiving a window events for a window that bevy doesn't know about.
- If you run multiple windowed bevy app sequentially, you can still receive old event that are destined for the previous test.
I intend to make multiple pull request to fix these problems in the coming days. You can check my WIP on https://github.com/refnil/bevy/commits/master.
Two quick questions that would help me make better pull requests?
- Could you force the event loop to drain outside of a bevy app?
- Is it intended/a good practice to panic! in a panic! in the task_pool Drop implementation?
Two inspirations for this issues:
- UnityTest attribute: Create an empty scene to run a test. It could also be a good idea when scene and system loading and unloading is ironed out. Loading a complete bevy app is more general anyway and could fit more purpose.
- Factorio integration testing video: Looks real nice and I want that for bevy haha.
Happy to ear what you think about this.
Thanks for your cool project.
What problem does this solve or what need does it fill?
Make game/project made with bevy as easily testable as possible. It would also help bevy proper since more integration test could be added.
Describe the solution would you like?
I would like to be able to run a bevy app from a #[test] function. In particular, I think it is important to be able to run windowed app.
Describe the alternative(s) you've considered?
Additional context
I have a working prototype that work for running test on linux with x11. First, let me explain the four problems that I had to solve to make it work.
I intend to make multiple pull request to fix these problems in the coming days. You can check my WIP on https://github.com/refnil/bevy/commits/master.
Two quick questions that would help me make better pull requests?
Two inspirations for this issues:
Happy to ear what you think about this.
Thanks for your cool project.