Skip to content

Tutorial: local test and coverage generation #88

Open
@SteveMacenski

Description

@SteveMacenski

e.g. a more focused version of what @gramss proposed in #87

  • How to run tests locally and see output (colcon test, test-result --verbose, where to find files in case you want to inspect)
  • How to run code coverage and see report locally (see below)
  • How to build nav2 docs and nav2 website locally and view
  • Elements of testing (unit tests + linters + launch tests) - in another tutorial about how to write / setup tests?
1. Build with GCOV enabled
$ cd ~/navigation2_ws/
$ colcon build --symlink-install --packages-select nav2_map_server --cmake-args -DCMAKE_CXX_FLAGS='--coverage' -DCMAKE_C_FLAGS='--coverage'

2. Run testcase manually
$ ./build/nav2_map_server/test/unit/test_costmap_filter_info_server

3. Run LCOV to get html-file
$ lcov --capture --directory build/nav2_map_server/CMakeFiles/map_server_core.dir/src/costmap_filter_info --output-file coverage.info
(in order to get what directory to specify to LCOV I've found required *.gcda file from all file list:
  $ find "build/nav2_costmap_2d/" -name "*.gcda")
$ genhtml coverage.info --output-directory out
$ firefox out/index.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions