Skip to content

Provide Examples and Documentation for using MockRos for testing. #250

@Carter12s

Description

@Carter12s

A huge advantage of roslibrust is that we can write proper node integration tests, run them "as fast as possible" on a machine, and run them in parallel with no "state leaking" to the host. This is especially cool thanks to tokio's tokio::time::pause() feature.

I'd like to expand the examples in roslibrust/examples to specifically show how to "nicely test" a component. Some very basic examples would be good, but I think folks would appreciate some fairly complex examples.

For each example:

  • Write a "node" that is Generic on the impl roslibrust::Ros trait
  • Have the node do something moderately complicated (ideally with sleeps and delays using tokio::time)
  • Use "#[tokio::test]" to set up some tests of that node, either pass in start_paused or invoke tokio::time::pause() on the first line
  • Fixture the node with a MockRos instance in the test
  • Make calls and assertions in the test
  • Measure how long the test takes to run (will be <1 ms probably).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions