-
 
No version for distro humble. Known supported distros are highlighted in the buttons above.
No version for distro jazzy. Known supported distros are highlighted in the buttons above.
No version for distro rolling. Known supported distros are highlighted in the buttons above.

code_coverage package from code_coverage repo

code_coverage

Package Summary

Tags No category tags.
Version 0.4.4
License BSD
Build type CATKIN
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/mikeferguson/code_coverage.git
VCS Type git
VCS Version master
Last Updated 2023-08-29
Dev Status DEVELOPED
CI status Continuous Integration : 0 / 0
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

CMake configuration to run coverage

Additional Links

Maintainers

  • Michael Ferguson

Authors

  • Michael Ferguson

code_coverage

ROS package to run coverage testing

Examples

  • The robot_calibration package uses this to generate coverage for C++ code using Travis-CI and Codecov.io

Usage

To use this with your ROS package:

  • Add code_coverage as a test depend in your package.xml
  • Update your CMakeLists.txt, in the testing section add the following. NOTE the order of test targets and coverage macros:
   if(CATKIN_ENABLE_TESTING AND ENABLE_COVERAGE_TESTING)
     find_package(code_coverage REQUIRED)
     # Add compiler flags for coverage instrumentation before defining any targets
     APPEND_COVERAGE_COMPILER_FLAGS()
   endif()
   
   # Add your targets here
   
   if (CATKIN_ENABLE_TESTING)
     # Add your tests here
   
     # Create a target ${PROJECT_NAME}_coverage_report
     if(ENABLE_COVERAGE_TESTING)
       set(COVERAGE_EXCLUDES "*/${PROJECT_NAME}/test*" "*/${PROJECT_NAME}/other_dir_i_dont_care_about*")
       add_code_coverage(
         NAME ${PROJECT_NAME}_coverage_report
         DEPENDENCIES _run_tests_${PROJECT_NAME}
       )
     endif()
   endif()
   
  • Note: The variable COVERAGE_EXCLUDES must have some content!
  • Now you can build and run the tests (you need a debug build to get reasonable coverage numbers):

    • if using CATKIN_MAKE:
      catkin_make -DENABLE_COVERAGE_TESTING=ON -DCMAKE_BUILD_TYPE=Debug
      catkin_make -DENABLE_COVERAGE_TESTING=ON -DCMAKE_BUILD_TYPE=Debug PACKAGE_NAME_coverage_report
  
  • if using CATKIN_TOOLS:
    catkin config --cmake-args -DENABLE_COVERAGE_TESTING=ON -DCMAKE_BUILD_TYPE=Debug
    catkin build
    catkin build PACKAGE_NAME -v --no-deps --catkin-make-args PACKAGE_NAME_coverage_report 
  
  • The output will print where the coverage report is located

Python rostest Support

While the C++ interface and Python-based unit tests require no modification to get coverage information, Python-based nodes run from rostest launch files need a bit of additional instrumentation turned on:

<launch>

    <!-- Add an argument to the launch file to turn on coverage -->
    <arg name="coverage" default="false"/>

    <!-- This fancy line forces nodes to generate coverage -->
    <arg name="pythontest_launch_prefix" value="$(eval 'python-coverage run -p' if arg('coverage') else '')"/>

    <!-- This node will NOT generate coverage information -->
    <node pkg="example_pkg" name="publisher_node" type="publisher_node.py" />

    <!-- But this node WILL generate coverage -->
    <node pkg="example_pkg" name="subscriber_node" type="subscriber_node.py"
          launch-prefix="$(arg pythontest_launch_prefix)" />

    <!-- The test can also generate coverage information if you include the launch-prefix -->
    <test time-limit="10" test-name="sample_rostest" pkg="example_pkg" type="sample_rostest.py"
          launch-prefix="$(arg pythontest_launch_prefix)" />

</launch>

In the CMakeLists, you will need to pass this argument:

add_rostest(example_rostest.test ARGS coverage:=ENABLE_COVERAGE_TESTING)

CHANGELOG

Changelog for package code_coverage

0.4.4 (2020-10-29)

  • Added python3-coverage support and error if python*-coverage is missing. (#27)
  • Contributors: Stefan Fabian

0.4.3 (2020-07-30)

  • Use multiple python coverage files (#23) Co-authored-by: hslusarek <<h.slusarek@pilz.de>>
  • add note that robot_calibration uses this package
  • fix #25
  • Add new report formats (#24)
    • Add html report format
    • Add console report format
    • Add '--include' and '--omit' flag to python-coverage commands
  • Contributors: Alexander Gutenkunst, Michael Ferguson, hslusarek

0.4.2 (2020-05-05)

  • Add option for specifying extra flags to genhtml (#20) This modification allows you to add flags to the genhtml step so that you can do things like output the lcov report with demangled C++ function names, e.g.: catkin_make -DGENHTML_EXTRA_FLAGS="--demangle-cpp" -DENABLE_COVERAGE_TESTING=ON -DCMAKE_BUILD_TYPE=Debug test1_coverage_report
  • Add catkin_make build step in usage example (#19)
  • bump cmake version for noetic
  • Contributors: Immanuel Martini, Michael Ferguson, mschickler

0.4.1 (2020-04-05)

  • update package.xml for noetic
  • Contributors: Michael Ferguson

0.4.0 (2020-04-02)

  • add support for python-based coverage (#18)
  • Contributors: Michael Ferguson

0.3.0 (2019-11-18)

  • update target name in readme
  • Merge pull request #15 from rhaschke/master Simplify + clarify usage
  • add link to original source
  • simplify usage
    • automatically include(CodeCoverage)
    • clarify that APPEND_COVERAGE_COMPILER_FLAGS() needs to be called before defining any target
  • Merge pull request #13 from leunMar/fix/usage_docu Fix example of add_code_coverage() in README.md
  • Fix example of add_code_coverage() in README.md
  • Contributors: Immanuel Martini, Michael Ferguson, Robert Haschke

0.2.4 (2019-07-18)

  • Merge pull request #11 from agutenkunst/master Keep *.info.cleaned. Closes #10
  • Keep *.info.cleaned. Closes #10
  • Merge pull request #8 from jschleicher/documentation documentation: degrade to test_depend
  • documentation degrade to test_depend and note that build type should be set to Debug
  • Contributors: Alexander Gutenkunst, Joachim Schleicher, Michael Ferguson

0.2.3 (2018-08-24)

  • Merge pull request #7 from jschleicher/fix/installed_package fix search path for installed package
  • fix search path for installed package Closes #6
  • Contributors: Joachim Schleicher, Michael Ferguson

0.2.2 (2018-08-21)

  • fix name of installspace file
  • Contributors: Michael Ferguson

0.2.1 (2018-08-13)

  • Merge pull request #3 from mikeferguson/catkin_build_fix Add support for catkin_tools (fixes #2)
  • add information on how to run with catkin_tools
  • minor escaping patch to work with catkin_tools
  • Contributors: Michael Ferguson

0.2.0 (2018-08-01)

  • First release
  • Contributors: Michael Ferguson

Wiki Tutorials

This package does not provide any links to tutorials in it's rosindex metadata. You can check on the ROS Wiki Tutorials page for the package.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged code_coverage at Robotics Stack Exchange

No version for distro ardent. Known supported distros are highlighted in the buttons above.
No version for distro bouncy. Known supported distros are highlighted in the buttons above.
No version for distro crystal. Known supported distros are highlighted in the buttons above.
No version for distro eloquent. Known supported distros are highlighted in the buttons above.
No version for distro dashing. Known supported distros are highlighted in the buttons above.
No version for distro galactic. Known supported distros are highlighted in the buttons above.
No version for distro foxy. Known supported distros are highlighted in the buttons above.
No version for distro iron. Known supported distros are highlighted in the buttons above.

code_coverage package from code_coverage repo

code_coverage

Package Summary

Tags No category tags.
Version 0.4.4
License BSD
Build type CATKIN
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/mikeferguson/code_coverage.git
VCS Type git
VCS Version master
Last Updated 2023-08-29
Dev Status DEVELOPED
CI status Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

CMake configuration to run coverage

Additional Links

Maintainers

  • Michael Ferguson

Authors

  • Michael Ferguson

code_coverage

ROS package to run coverage testing

Examples

  • The robot_calibration package uses this to generate coverage for C++ code using Travis-CI and Codecov.io

Usage

To use this with your ROS package:

  • Add code_coverage as a test depend in your package.xml
  • Update your CMakeLists.txt, in the testing section add the following. NOTE the order of test targets and coverage macros:
   if(CATKIN_ENABLE_TESTING AND ENABLE_COVERAGE_TESTING)
     find_package(code_coverage REQUIRED)
     # Add compiler flags for coverage instrumentation before defining any targets
     APPEND_COVERAGE_COMPILER_FLAGS()
   endif()
   
   # Add your targets here
   
   if (CATKIN_ENABLE_TESTING)
     # Add your tests here
   
     # Create a target ${PROJECT_NAME}_coverage_report
     if(ENABLE_COVERAGE_TESTING)
       set(COVERAGE_EXCLUDES "*/${PROJECT_NAME}/test*" "*/${PROJECT_NAME}/other_dir_i_dont_care_about*")
       add_code_coverage(
         NAME ${PROJECT_NAME}_coverage_report
         DEPENDENCIES _run_tests_${PROJECT_NAME}
       )
     endif()
   endif()
   
  • Note: The variable COVERAGE_EXCLUDES must have some content!
  • Now you can build and run the tests (you need a debug build to get reasonable coverage numbers):

    • if using CATKIN_MAKE:
      catkin_make -DENABLE_COVERAGE_TESTING=ON -DCMAKE_BUILD_TYPE=Debug
      catkin_make -DENABLE_COVERAGE_TESTING=ON -DCMAKE_BUILD_TYPE=Debug PACKAGE_NAME_coverage_report
  
  • if using CATKIN_TOOLS:
    catkin config --cmake-args -DENABLE_COVERAGE_TESTING=ON -DCMAKE_BUILD_TYPE=Debug
    catkin build
    catkin build PACKAGE_NAME -v --no-deps --catkin-make-args PACKAGE_NAME_coverage_report 
  
  • The output will print where the coverage report is located

Python rostest Support

While the C++ interface and Python-based unit tests require no modification to get coverage information, Python-based nodes run from rostest launch files need a bit of additional instrumentation turned on:

<launch>

    <!-- Add an argument to the launch file to turn on coverage -->
    <arg name="coverage" default="false"/>

    <!-- This fancy line forces nodes to generate coverage -->
    <arg name="pythontest_launch_prefix" value="$(eval 'python-coverage run -p' if arg('coverage') else '')"/>

    <!-- This node will NOT generate coverage information -->
    <node pkg="example_pkg" name="publisher_node" type="publisher_node.py" />

    <!-- But this node WILL generate coverage -->
    <node pkg="example_pkg" name="subscriber_node" type="subscriber_node.py"
          launch-prefix="$(arg pythontest_launch_prefix)" />

    <!-- The test can also generate coverage information if you include the launch-prefix -->
    <test time-limit="10" test-name="sample_rostest" pkg="example_pkg" type="sample_rostest.py"
          launch-prefix="$(arg pythontest_launch_prefix)" />

</launch>

In the CMakeLists, you will need to pass this argument:

add_rostest(example_rostest.test ARGS coverage:=ENABLE_COVERAGE_TESTING)

CHANGELOG

Changelog for package code_coverage

0.4.4 (2020-10-29)

  • Added python3-coverage support and error if python*-coverage is missing. (#27)
  • Contributors: Stefan Fabian

0.4.3 (2020-07-30)

  • Use multiple python coverage files (#23) Co-authored-by: hslusarek <<h.slusarek@pilz.de>>
  • add note that robot_calibration uses this package
  • fix #25
  • Add new report formats (#24)
    • Add html report format
    • Add console report format
    • Add '--include' and '--omit' flag to python-coverage commands
  • Contributors: Alexander Gutenkunst, Michael Ferguson, hslusarek

0.4.2 (2020-05-05)

  • Add option for specifying extra flags to genhtml (#20) This modification allows you to add flags to the genhtml step so that you can do things like output the lcov report with demangled C++ function names, e.g.: catkin_make -DGENHTML_EXTRA_FLAGS="--demangle-cpp" -DENABLE_COVERAGE_TESTING=ON -DCMAKE_BUILD_TYPE=Debug test1_coverage_report
  • Add catkin_make build step in usage example (#19)
  • bump cmake version for noetic
  • Contributors: Immanuel Martini, Michael Ferguson, mschickler

0.4.1 (2020-04-05)

  • update package.xml for noetic
  • Contributors: Michael Ferguson

0.4.0 (2020-04-02)

  • add support for python-based coverage (#18)
  • Contributors: Michael Ferguson

0.3.0 (2019-11-18)

  • update target name in readme
  • Merge pull request #15 from rhaschke/master Simplify + clarify usage
  • add link to original source
  • simplify usage
    • automatically include(CodeCoverage)
    • clarify that APPEND_COVERAGE_COMPILER_FLAGS() needs to be called before defining any target
  • Merge pull request #13 from leunMar/fix/usage_docu Fix example of add_code_coverage() in README.md
  • Fix example of add_code_coverage() in README.md
  • Contributors: Immanuel Martini, Michael Ferguson, Robert Haschke

0.2.4 (2019-07-18)

  • Merge pull request #11 from agutenkunst/master Keep *.info.cleaned. Closes #10
  • Keep *.info.cleaned. Closes #10
  • Merge pull request #8 from jschleicher/documentation documentation: degrade to test_depend
  • documentation degrade to test_depend and note that build type should be set to Debug
  • Contributors: Alexander Gutenkunst, Joachim Schleicher, Michael Ferguson

0.2.3 (2018-08-24)

  • Merge pull request #7 from jschleicher/fix/installed_package fix search path for installed package
  • fix search path for installed package Closes #6
  • Contributors: Joachim Schleicher, Michael Ferguson

0.2.2 (2018-08-21)

  • fix name of installspace file
  • Contributors: Michael Ferguson

0.2.1 (2018-08-13)

  • Merge pull request #3 from mikeferguson/catkin_build_fix Add support for catkin_tools (fixes #2)
  • add information on how to run with catkin_tools
  • minor escaping patch to work with catkin_tools
  • Contributors: Michael Ferguson

0.2.0 (2018-08-01)

  • First release
  • Contributors: Michael Ferguson

Wiki Tutorials

This package does not provide any links to tutorials in it's rosindex metadata. You can check on the ROS Wiki Tutorials page for the package.

Package Dependencies

Deps Name
catkin

System Dependencies

Dependant Packages

No known dependants.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged code_coverage at Robotics Stack Exchange

No version for distro jade. Known supported distros are highlighted in the buttons above.
No version for distro indigo. Known supported distros are highlighted in the buttons above.
No version for distro hydro. Known supported distros are highlighted in the buttons above.

code_coverage package from code_coverage repo

code_coverage

Package Summary

Tags No category tags.
Version 0.4.4
License BSD
Build type CATKIN
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/mikeferguson/code_coverage.git
VCS Type git
VCS Version master
Last Updated 2023-08-29
Dev Status DEVELOPED
CI status Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

CMake configuration to run coverage

Additional Links

Maintainers

  • Michael Ferguson

Authors

  • Michael Ferguson

code_coverage

ROS package to run coverage testing

Examples

  • The robot_calibration package uses this to generate coverage for C++ code using Travis-CI and Codecov.io

Usage

To use this with your ROS package:

  • Add code_coverage as a test depend in your package.xml
  • Update your CMakeLists.txt, in the testing section add the following. NOTE the order of test targets and coverage macros:
   if(CATKIN_ENABLE_TESTING AND ENABLE_COVERAGE_TESTING)
     find_package(code_coverage REQUIRED)
     # Add compiler flags for coverage instrumentation before defining any targets
     APPEND_COVERAGE_COMPILER_FLAGS()
   endif()
   
   # Add your targets here
   
   if (CATKIN_ENABLE_TESTING)
     # Add your tests here
   
     # Create a target ${PROJECT_NAME}_coverage_report
     if(ENABLE_COVERAGE_TESTING)
       set(COVERAGE_EXCLUDES "*/${PROJECT_NAME}/test*" "*/${PROJECT_NAME}/other_dir_i_dont_care_about*")
       add_code_coverage(
         NAME ${PROJECT_NAME}_coverage_report
         DEPENDENCIES _run_tests_${PROJECT_NAME}
       )
     endif()
   endif()
   
  • Note: The variable COVERAGE_EXCLUDES must have some content!
  • Now you can build and run the tests (you need a debug build to get reasonable coverage numbers):

    • if using CATKIN_MAKE:
      catkin_make -DENABLE_COVERAGE_TESTING=ON -DCMAKE_BUILD_TYPE=Debug
      catkin_make -DENABLE_COVERAGE_TESTING=ON -DCMAKE_BUILD_TYPE=Debug PACKAGE_NAME_coverage_report
  
  • if using CATKIN_TOOLS:
    catkin config --cmake-args -DENABLE_COVERAGE_TESTING=ON -DCMAKE_BUILD_TYPE=Debug
    catkin build
    catkin build PACKAGE_NAME -v --no-deps --catkin-make-args PACKAGE_NAME_coverage_report 
  
  • The output will print where the coverage report is located

Python rostest Support

While the C++ interface and Python-based unit tests require no modification to get coverage information, Python-based nodes run from rostest launch files need a bit of additional instrumentation turned on:

<launch>

    <!-- Add an argument to the launch file to turn on coverage -->
    <arg name="coverage" default="false"/>

    <!-- This fancy line forces nodes to generate coverage -->
    <arg name="pythontest_launch_prefix" value="$(eval 'python-coverage run -p' if arg('coverage') else '')"/>

    <!-- This node will NOT generate coverage information -->
    <node pkg="example_pkg" name="publisher_node" type="publisher_node.py" />

    <!-- But this node WILL generate coverage -->
    <node pkg="example_pkg" name="subscriber_node" type="subscriber_node.py"
          launch-prefix="$(arg pythontest_launch_prefix)" />

    <!-- The test can also generate coverage information if you include the launch-prefix -->
    <test time-limit="10" test-name="sample_rostest" pkg="example_pkg" type="sample_rostest.py"
          launch-prefix="$(arg pythontest_launch_prefix)" />

</launch>

In the CMakeLists, you will need to pass this argument:

add_rostest(example_rostest.test ARGS coverage:=ENABLE_COVERAGE_TESTING)

CHANGELOG

Changelog for package code_coverage

0.4.4 (2020-10-29)

  • Added python3-coverage support and error if python*-coverage is missing. (#27)
  • Contributors: Stefan Fabian

0.4.3 (2020-07-30)

  • Use multiple python coverage files (#23) Co-authored-by: hslusarek <<h.slusarek@pilz.de>>
  • add note that robot_calibration uses this package
  • fix #25
  • Add new report formats (#24)
    • Add html report format
    • Add console report format
    • Add '--include' and '--omit' flag to python-coverage commands
  • Contributors: Alexander Gutenkunst, Michael Ferguson, hslusarek

0.4.2 (2020-05-05)

  • Add option for specifying extra flags to genhtml (#20) This modification allows you to add flags to the genhtml step so that you can do things like output the lcov report with demangled C++ function names, e.g.: catkin_make -DGENHTML_EXTRA_FLAGS="--demangle-cpp" -DENABLE_COVERAGE_TESTING=ON -DCMAKE_BUILD_TYPE=Debug test1_coverage_report
  • Add catkin_make build step in usage example (#19)
  • bump cmake version for noetic
  • Contributors: Immanuel Martini, Michael Ferguson, mschickler

0.4.1 (2020-04-05)

  • update package.xml for noetic
  • Contributors: Michael Ferguson

0.4.0 (2020-04-02)

  • add support for python-based coverage (#18)
  • Contributors: Michael Ferguson

0.3.0 (2019-11-18)

  • update target name in readme
  • Merge pull request #15 from rhaschke/master Simplify + clarify usage
  • add link to original source
  • simplify usage
    • automatically include(CodeCoverage)
    • clarify that APPEND_COVERAGE_COMPILER_FLAGS() needs to be called before defining any target
  • Merge pull request #13 from leunMar/fix/usage_docu Fix example of add_code_coverage() in README.md
  • Fix example of add_code_coverage() in README.md
  • Contributors: Immanuel Martini, Michael Ferguson, Robert Haschke

0.2.4 (2019-07-18)

  • Merge pull request #11 from agutenkunst/master Keep *.info.cleaned. Closes #10
  • Keep *.info.cleaned. Closes #10
  • Merge pull request #8 from jschleicher/documentation documentation: degrade to test_depend
  • documentation degrade to test_depend and note that build type should be set to Debug
  • Contributors: Alexander Gutenkunst, Joachim Schleicher, Michael Ferguson

0.2.3 (2018-08-24)

  • Merge pull request #7 from jschleicher/fix/installed_package fix search path for installed package
  • fix search path for installed package Closes #6
  • Contributors: Joachim Schleicher, Michael Ferguson

0.2.2 (2018-08-21)

  • fix name of installspace file
  • Contributors: Michael Ferguson

0.2.1 (2018-08-13)

  • Merge pull request #3 from mikeferguson/catkin_build_fix Add support for catkin_tools (fixes #2)
  • add information on how to run with catkin_tools
  • minor escaping patch to work with catkin_tools
  • Contributors: Michael Ferguson

0.2.0 (2018-08-01)

  • First release
  • Contributors: Michael Ferguson

Wiki Tutorials

This package does not provide any links to tutorials in it's rosindex metadata. You can check on the ROS Wiki Tutorials page for the package.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged code_coverage at Robotics Stack Exchange

code_coverage package from code_coverage repo

code_coverage

Package Summary

Tags No category tags.
Version 0.4.4
License BSD
Build type CATKIN
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/mikeferguson/code_coverage.git
VCS Type git
VCS Version master
Last Updated 2023-08-29
Dev Status DEVELOPED
CI status Continuous Integration : 0 / 0
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

CMake configuration to run coverage

Additional Links

Maintainers

  • Michael Ferguson

Authors

  • Michael Ferguson

code_coverage

ROS package to run coverage testing

Examples

  • The robot_calibration package uses this to generate coverage for C++ code using Travis-CI and Codecov.io

Usage

To use this with your ROS package:

  • Add code_coverage as a test depend in your package.xml
  • Update your CMakeLists.txt, in the testing section add the following. NOTE the order of test targets and coverage macros:
   if(CATKIN_ENABLE_TESTING AND ENABLE_COVERAGE_TESTING)
     find_package(code_coverage REQUIRED)
     # Add compiler flags for coverage instrumentation before defining any targets
     APPEND_COVERAGE_COMPILER_FLAGS()
   endif()
   
   # Add your targets here
   
   if (CATKIN_ENABLE_TESTING)
     # Add your tests here
   
     # Create a target ${PROJECT_NAME}_coverage_report
     if(ENABLE_COVERAGE_TESTING)
       set(COVERAGE_EXCLUDES "*/${PROJECT_NAME}/test*" "*/${PROJECT_NAME}/other_dir_i_dont_care_about*")
       add_code_coverage(
         NAME ${PROJECT_NAME}_coverage_report
         DEPENDENCIES _run_tests_${PROJECT_NAME}
       )
     endif()
   endif()
   
  • Note: The variable COVERAGE_EXCLUDES must have some content!
  • Now you can build and run the tests (you need a debug build to get reasonable coverage numbers):

    • if using CATKIN_MAKE:
      catkin_make -DENABLE_COVERAGE_TESTING=ON -DCMAKE_BUILD_TYPE=Debug
      catkin_make -DENABLE_COVERAGE_TESTING=ON -DCMAKE_BUILD_TYPE=Debug PACKAGE_NAME_coverage_report
  
  • if using CATKIN_TOOLS:
    catkin config --cmake-args -DENABLE_COVERAGE_TESTING=ON -DCMAKE_BUILD_TYPE=Debug
    catkin build
    catkin build PACKAGE_NAME -v --no-deps --catkin-make-args PACKAGE_NAME_coverage_report 
  
  • The output will print where the coverage report is located

Python rostest Support

While the C++ interface and Python-based unit tests require no modification to get coverage information, Python-based nodes run from rostest launch files need a bit of additional instrumentation turned on:

<launch>

    <!-- Add an argument to the launch file to turn on coverage -->
    <arg name="coverage" default="false"/>

    <!-- This fancy line forces nodes to generate coverage -->
    <arg name="pythontest_launch_prefix" value="$(eval 'python-coverage run -p' if arg('coverage') else '')"/>

    <!-- This node will NOT generate coverage information -->
    <node pkg="example_pkg" name="publisher_node" type="publisher_node.py" />

    <!-- But this node WILL generate coverage -->
    <node pkg="example_pkg" name="subscriber_node" type="subscriber_node.py"
          launch-prefix="$(arg pythontest_launch_prefix)" />

    <!-- The test can also generate coverage information if you include the launch-prefix -->
    <test time-limit="10" test-name="sample_rostest" pkg="example_pkg" type="sample_rostest.py"
          launch-prefix="$(arg pythontest_launch_prefix)" />

</launch>

In the CMakeLists, you will need to pass this argument:

add_rostest(example_rostest.test ARGS coverage:=ENABLE_COVERAGE_TESTING)

CHANGELOG

Changelog for package code_coverage

0.4.4 (2020-10-29)

  • Added python3-coverage support and error if python*-coverage is missing. (#27)
  • Contributors: Stefan Fabian

0.4.3 (2020-07-30)

  • Use multiple python coverage files (#23) Co-authored-by: hslusarek <<h.slusarek@pilz.de>>
  • add note that robot_calibration uses this package
  • fix #25
  • Add new report formats (#24)
    • Add html report format
    • Add console report format
    • Add '--include' and '--omit' flag to python-coverage commands
  • Contributors: Alexander Gutenkunst, Michael Ferguson, hslusarek

0.4.2 (2020-05-05)

  • Add option for specifying extra flags to genhtml (#20) This modification allows you to add flags to the genhtml step so that you can do things like output the lcov report with demangled C++ function names, e.g.: catkin_make -DGENHTML_EXTRA_FLAGS="--demangle-cpp" -DENABLE_COVERAGE_TESTING=ON -DCMAKE_BUILD_TYPE=Debug test1_coverage_report
  • Add catkin_make build step in usage example (#19)
  • bump cmake version for noetic
  • Contributors: Immanuel Martini, Michael Ferguson, mschickler

0.4.1 (2020-04-05)

  • update package.xml for noetic
  • Contributors: Michael Ferguson

0.4.0 (2020-04-02)

  • add support for python-based coverage (#18)
  • Contributors: Michael Ferguson

0.3.0 (2019-11-18)

  • update target name in readme
  • Merge pull request #15 from rhaschke/master Simplify + clarify usage
  • add link to original source
  • simplify usage
    • automatically include(CodeCoverage)
    • clarify that APPEND_COVERAGE_COMPILER_FLAGS() needs to be called before defining any target
  • Merge pull request #13 from leunMar/fix/usage_docu Fix example of add_code_coverage() in README.md
  • Fix example of add_code_coverage() in README.md
  • Contributors: Immanuel Martini, Michael Ferguson, Robert Haschke

0.2.4 (2019-07-18)

  • Merge pull request #11 from agutenkunst/master Keep *.info.cleaned. Closes #10
  • Keep *.info.cleaned. Closes #10
  • Merge pull request #8 from jschleicher/documentation documentation: degrade to test_depend
  • documentation degrade to test_depend and note that build type should be set to Debug
  • Contributors: Alexander Gutenkunst, Joachim Schleicher, Michael Ferguson

0.2.3 (2018-08-24)

  • Merge pull request #7 from jschleicher/fix/installed_package fix search path for installed package
  • fix search path for installed package Closes #6
  • Contributors: Joachim Schleicher, Michael Ferguson

0.2.2 (2018-08-21)

  • fix name of installspace file
  • Contributors: Michael Ferguson

0.2.1 (2018-08-13)

  • Merge pull request #3 from mikeferguson/catkin_build_fix Add support for catkin_tools (fixes #2)
  • add information on how to run with catkin_tools
  • minor escaping patch to work with catkin_tools
  • Contributors: Michael Ferguson

0.2.0 (2018-08-01)

  • First release
  • Contributors: Michael Ferguson

Wiki Tutorials

This package does not provide any links to tutorials in it's rosindex metadata. You can check on the ROS Wiki Tutorials page for the package.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged code_coverage at Robotics Stack Exchange