Skip to content

Automated test for Bevy through BRP#23647

Merged
alice-i-cecile merged 8 commits intobevyengine:mainfrom
mockersf:old-school-automated-tests
Apr 5, 2026
Merged

Automated test for Bevy through BRP#23647
alice-i-cecile merged 8 commits intobevyengine:mainfrom
mockersf:old-school-automated-tests

Conversation

@mockersf
Copy link
Copy Markdown
Member

@mockersf mockersf commented Apr 3, 2026

Objective

  • Show how a Bevy app can be automated through BRP

Solution

  • Example app_under_test is a basic app with a randomly placed button. when the button is clicked, the app quit
  • Example automated_test click that button through BRP using WindowEvent so that it goes through the whole of Bevy

Testing

  • Run both example and they both exit

@mockersf mockersf force-pushed the old-school-automated-tests branch from 3679862 to 0e1f61c Compare April 3, 2026 18:01
@mockersf mockersf force-pushed the old-school-automated-tests branch from 0e1f61c to 6750aa1 Compare April 3, 2026 18:02
@kfc35 kfc35 added C-Examples An addition or correction to our examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward A-Dev-Tools Tools used to debug Bevy applications. labels Apr 3, 2026
@kfc35 kfc35 self-requested a review April 3, 2026 23:10
Copy link
Copy Markdown
Contributor

@kfc35 kfc35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@kfc35 kfc35 added C-Testing A change that impacts how we test Bevy or how users test their apps D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes labels Apr 4, 2026
@alice-i-cecile
Copy link
Copy Markdown
Member

Once this is merged, the testing section of the Bevy Book should be updated to link to this example.

Co-authored-by: Kevin Chen <chen.kevin.f@gmail.com>
@mockersf
Copy link
Copy Markdown
Member Author

mockersf commented Apr 4, 2026

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.

I think that's more book content than example content.

Also my long term goal is to have something similar to playwright in usability, but I failed to do it for a while so decided to go step by step and start with something that is like selenium 1.

I plan to add a bevy_integration_test_through_brp (or something else if I find a better name by then) with nice wrapper methods to send a mouse click on an element, automatic waits, assertions and selectors. I'll probably iterate in examples until I have something that could use its own crate.

@kfc35 kfc35 added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Apr 4, 2026
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Apr 5, 2026
Merged via the queue into bevyengine:main with commit f865af1 Apr 5, 2026
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Dev-Tools Tools used to debug Bevy applications. C-Examples An addition or correction to our examples C-Testing A change that impacts how we test Bevy or how users test their apps D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants