bevy
bevy copied to clipboard
Add test plugin group
Objective
Work towards closing #5931
Solution
- Add a
TestPluginsgroup that addsMinimalPlugins,AssetPlugin,ScenePlugin,WindowPlugin,GilrsPlugin,TransformPlugin,HierarchyPlugin,DiagnosticsPlugin, andInputPlugin. - Added an example for how to use it. The example gets run in CI, which should make sure that no future change ever breaks any of the plugins in Github Actions
Limitations
bevy_rapierwill not work as it depends onRenderPlugin, but this is fixed in #5933.- While this is usable,
LogPlugincannot be added until #4934 is resolved
Changelog
Added
TestPlugins group that adds plugins suitable for use in automated tests.
I would rather have a feature that would enable only what is interesting in CI than a plugin group. The feature would help reducing compile time.
I would rather have a feature that would enable only what is interesting in CI than a plugin group. The feature would help reducing compile time.
Any tests that run can't have WinitPlugin, and as far as I can tell there's no way to tell cargo to automatically compile bevy with different features when running cargo test. Even if there were, I want to leave open the possibility of having a custom test harness that allows you to re-run failing tests using DefaultPlugins so you can see what's going on.
The example should live in the root level
testsdirectory, which will avoid the shenanigans :) We should try and publicize that better though; perhaps we can add a note to the examples README?
Done. There was already how_to_test_systems.rs, but I kept my example because it's much simpler than the other one.
@mockersf I want your opinion on the organization here. I think it's interesting that we're linking to this from the examples README / including it in the cargo.toml. Unsure if it's the right choice!
@mockersf I want your opinion on the organization here. I think it's interesting that we're linking to this from the examples README / including it in the cargo.toml. Unsure if it's the right choice!
One problem with this structure is that it causes cargo to print Warning: file tests/automated_tests.rs is included in multiple build targets (or something along those lines, I'm working from memory). But CI fails I include it in the examples page without including it in Cargo.toml, because running cargo run -p build-example-pages fails (as it detects there is something in the examples page that it thinks should not be there).
When I test something on CI I add only plugins I need. So I wouldn't add a specific plugin group.
Closing out; I don't think this is a reliable enough solution to include at the engine level.