watonomous.github.io

  1. Software Division
  2. Software Division Home
  3. Path Planning Group

[ Software Division : Unit Testing + Development Practices ]

Created by [ Charles Zhang], last modified on Jan 09, 2020

Development Practices

Please comment your code! we have enough un-commented code as is (smile){.emoticon .emoticon-smile}

eg: https://git.uwaterloo.ca/WATonomous/decision/merge_requests/216

Unit Testing

Run using: catkin_make run_tests

Unit tests are located in decision/test/. Upon catkin_make run_tests, the decision/path_planning.test file is launched and results are displayed to the screen.

[{.confluence-embedded-image .shrinkToFit .confluence-external-resource height=”250”}]{.confluence-embedded-file-wrapper .confluence-embedded-manual-size}[{.confluence-embedded-image .shrinkToFit .confluence-external-resource height=”250”}]{.confluence-embedded-file-wrapper .confluence-embedded-manual-size}

Re-running the tests using rosrun path_planning local_planner_test provides a much nicer gui:

[{.confluence-embedded-image height=”250”}]{.confluence-embedded-file-wrapper .confluence-embedded-manual-size}

Writing Unit Tests:

C++ Unit tests are written through RosTest using the GTest Framework

How many unit tests should I write?

Adding new Unit Tests:

When adding unit tests, either add to your existing module's test file, or if you are creating a new set of unit tests for a new module / feature, create a new .cpp file for you new unit testing suite.

If you're adding a new cpp file:

CMakeLists.txt

# Unit Testing Node

if(CATKIN_ENABLE_TESTING)
  find_package(rostest REQUIRED)
  add_rostest_gtest(local_planner_test
                    ./test/path_planning.test
                    ./test/utest_main.cpp
                    ./test/geom_test.cpp
                    ./test/behavioral_test.cpp
                    $
                    $)
  target_link_libraries(local_planner_test $)
  add_dependencies(local_planner_test $)
  add_dependencies(local_planner_test $)
endif()

Resources:

\

Attachments:

image2020-1-9_0-15-31.png (image/png)\

Document generated by Confluence on Dec 10, 2021 04:01

Atlassian