Table Of Contents

Previous topic

Downloading test data

Next topic

Configuring Python nose tests

This Page

Configuring gtest for C++

Gtest is the Google framework for running C++ unit tests. It is a pure C++ framework. No ROS environment is available. See: Configuring rostest if your tests need a running roscore.


The rosunit package is needed for testing:



Declare each gtest like this:

  catkin_add_gtest(test_your_node tests/test_your_node.cpp)
  target_link_libraries(test_your_node ${catkin_LIBRARIES})

This example assumes your tests are defined in the tests/ subdirectory in your source tree.

If other libraries are needed to compile your test program, see Building and installing C++ executables for details.