1
$\begingroup$

Rosanswers logo

I'm pretty new to ROS, so my knowledge with ROS, catkin and, cmake is pretty basic. I have some questions on how should I proceed with the tests of my packages. The goal is to allow execution of each specific tests, but right now it's currently grouped (i.e, group-test-1, group-test-2, group-test-3, etc).

Here's the current setup:

  • Rostest is usable only in devel mode. I need to use install mode since it's the artifact that we're going to use in production.

  • I'm currently using catkin run_tests (i.e., catkin run_tests -Dgroup-test-1=on) to execute all tests for that group. I'm using options to group it, then have a foreach loop to create a test using add_rostest_gtest

  • It's not possible to run --gtest-filter since it also run some scripts

So far, here's what I think are the possible solutions:

  • Is it possible to use rostest in install mode? I haven't found a way to do it.

  • Does it make sense if I add options in my foreach loop so that I can use it this way "catkin run_test -Dgroup-test-1-specific-test-1=on", but I'm not sure if this will work.

  • ROS: Melodic

  • Catkin tools: 0.6.1

  • Python: 2.7.17

  • Cmake: 3.10.2

  • Gtest

I'm not sure if I'm in the right path. Any tips or advice will be really helpful.


Originally posted by achluomalus on ROS Answers with karma: 11 on 2020-11-02

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

This #q307598 says to make the tests into a normal executables outside of the rostest infrastructure, but I think you can do this install (I'll update after I get it working or not)

install(DIRECTORY test/ DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/test)

also

install(PROGRAMS
  test/my_test.py
  DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

This installs the test file into two places though, but only the BIN destination one executes, to avoid that the .test files could be split up from the .py files they are coupled with into different directories.


Originally posted by lucasw with karma: 8729 on 2021-10-25

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by 130s on 2022-08-26:
I marked this as an answer, as I've done simular/the same things and worked out.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.