-
Notifications
You must be signed in to change notification settings - Fork 276
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
Expose a test fixture helper class #926
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding the TODO I've opened #930. This will make it easier to perform tests at startup. Most of my comments are minor nitpicks.
@mjcarroll , I merged from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good to me. The only comment I have is that the example requires CMake 3.11 and Ubuntu Bionic ships with 3.10. We claim that Fortress is supported in Ubuntu Bionic. I think this is OK as it's one example and there are other alternative ways to install CMake.
Signed-off-by: Louise Poubel <[email protected]>
Signed-off-by: Louise Poubel <[email protected]>
9963485
to
a05623d
Compare
Codecov Report
@@ Coverage Diff @@
## ign-gazebo3 #926 +/- ##
===============================================
+ Coverage 77.80% 77.90% +0.10%
===============================================
Files 220 221 +1
Lines 12579 12639 +60
===============================================
+ Hits 9787 9847 +60
Misses 2792 2792
Continue to review full report at Codecov.
|
🎉 New feature
Summary
It's not always straightforward to write automated tests that leverage
ign-gazebo
from external projects. Internal to Gazebo, we have various helper classes in test/helpers that make it easier to write integration tests. The goal of this PR is to expose a public API that makes it easier to write tests similar to those.The main class being added in this PR is the
TestFixture
. See the added example for how to use it in an external project together with GTest. Example usage from the classes's docs:Besides
test/helpers
, a lot of the inspiration here is coming from @arjo129 's work on a separate project.Differences from test/helpers
While working on the public API I made some improvements over what we are currently using internally:
Server::AddSystem
APIs that allow us to load a plugin created on the fly, instead of needing to load a shared library. (i.e. no more need forlibMockPlugin.so
, see theHelperSystem
instead)TestFixture
, unliketest/helpers/Relay
, instantiates a server automatically. This saves even more boilerplate in test code.Test it
Run the new standalone example. I made an effort to use classes like
World
andModel
on the example test in order to make it as approachable as possible. (i.e. noEach
calls)TODO
TODO before merging:
Server::AddSystem
TestFixture
TODO in the future:
Tying into the simulation update loop is very powerful, but it can be inconvenient for doing one-time setup operations, such as getting a model's entity ID.Done in Add a way to perform startup checks usingTestFixture
. #930Checklist
codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge
🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸