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

Integration Tests incorrect #54

Closed
gschup opened this issue Mar 30, 2023 · 2 comments
Closed

Integration Tests incorrect #54

gschup opened this issue Mar 30, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@gschup
Copy link
Owner

gschup commented Mar 30, 2023

I deleted the integration tests I previously merged. While I like the idea of having more testing not only on ggrs, but also the plugin, these tests did not correctly test what should happen. This should be fixed at some point.

@gschup gschup added the bug Something isn't working label Mar 30, 2023
@donedgardo
Copy link
Contributor

donedgardo commented Mar 31, 2023

I'd love to contribute for this.
In general can we get a conversation going on what should be tested instead?

As a person integrating this library into their bevy game I'd like to see that:

  • Systems in the Rollback stage should run.
  • Rollback Components get synced between two applications with active session between each other.
  • Test simple integration (great for documentation) between bevy and the plugin.
  • Enough test that make us feel confident on improving the code and internal systems.

The test in the link provided would be a good start, I would remove line

assert_eq!(frame_count1.frame, frame_count2.frame);

It is not expected that the two systems are completely in sync only that both system are being scheduled and executed.

Additionally the second test would be a good candidate for the integration test and rollback behavior's:

fn it_syncs_rollback_components() -> Result<(), Box<dyn std::error::Error>> {

Now with thanks to this helper function or something very similar, we can now also test frame by frame scenarios/edge cases:

https://github.com/johanhelsing/bevy_xpbd_jondolf/blob/0d2582fc9fb6a5324d50f922d933612a76461d30/src/tests.rs#L33

fn tick_60_fps(app: &mut App) {
    let mut update_strategy = app.world.resource_mut::<TimeUpdateStrategy>();
    let TimeUpdateStrategy::ManualInstant(prev_time) = *update_strategy else { unimplemented!() };
    *update_strategy =
        TimeUpdateStrategy::ManualInstant(prev_time + Duration::from_secs_f64(1. / 60.));
    app.update();
}

@gschup
Copy link
Owner Author

gschup commented Oct 19, 2023

solved in #69 . we now have a nice basis to extend integration tests from if we wish to do so!

@gschup gschup closed this as completed Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants