Skip to content
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

Add convenience methods for integration testing the ECS #3814

Open
alice-i-cecile opened this issue Jan 30, 2022 · 1 comment
Open

Add convenience methods for integration testing the ECS #3814

alice-i-cecile opened this issue Jan 30, 2022 · 1 comment
Labels
A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use

Comments

@alice-i-cecile
Copy link
Member

What problem does this solve or what need does it fill?

Integration testing is important, but our existing tools for it are boilerplate-heavy.

What solution would you like?

There are a few patterns that come up very regularly, and should be supported directly on the App and World:

  • assert that the resource of the given type matches the provided value
  • assert that all components that match a query match the given tuple of values
  • assert that the number of entities returned by a query is n

Each method on App should just call the underlying method on World.

What alternative(s) have you considered?

These helper methods can be written entirely externally. However, this is suboptimal because:

  • friction is one of the largest barriers to testing
  • this code is going to be exactly the same across all serious products created with Bevy
  • Bevy itself should be integration tested, and would benefit from these ergonomics improvements

Additional context

This pattern is very useful when combined with manually calling app.update() in your integration tests.

#3786 would make organizing these sorts of ergonomics methods more convenient.

I've also written a number of tools for input-mocking that are very useful, but those should be considered in a separate issue / PR.

@alice-i-cecile alice-i-cecile added D-Trivial Nice and easy! A great choice to get started with Bevy A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use labels Jan 30, 2022
@alice-i-cecile
Copy link
Member Author

I'm going to tackle this one :)

@alice-i-cecile alice-i-cecile removed the D-Trivial Nice and easy! A great choice to get started with Bevy label Feb 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use
Projects
None yet
Development

No branches or pull requests

1 participant