ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

rostest: Test node does not exist or is not executable

asked 2017-11-14 06:48:52 -0500

Westranger gravatar image

updated 2017-11-14 06:54:19 -0500

I'm currently writing unit / integration tests for my nodes and i'm stuck adding them the the build scripts. When running

rostest my_pkg tests.test

I get the following error

[Testcase: testtest_vehicle_controller] ... FAILURE!
FAILURE: Test node [my_pkg/test_vehicle_controller.py] does not exist or is not executable
  File "/usr/lib/python2.7/unittest/case.py", line 329, in run
    testMethod()
  File "/opt/ros/lunar/lib/python2.7/dist-packages/rostest/runner.py", line 93, in fn
    self.fail(message)
  File "/usr/lib/python2.7/unittest/case.py", line 410, in fail
    raise self.failureException(msg)
--------------------------------------------------------------------------------

[ROSTEST]-----------------------------------------------------------------------

[testtest_vehicle_controller][failed]

SUMMARY
 * RESULT: FAIL
 * TESTS: 0
 * ERRORS: 0
 * FAILURES: 1

ERROR: The following tests failed to run:
 * testtest_vehicle_controller

my tests.test file looks like this

<launch>
  <test test-name="test_vehicle_controller" pkg="my_pkg" type="test_vehicle_controller.py" />
</launch>

my package structure looks like this

├── CMakeLists.txt
├── include
├── package.xml
├── src
│   ├── __init__.py
│   ├── __init__.pyc
│   ├── main
│   │   ├── __init__.py
│   │   └── vehicle_controller.py
│   └── tests
│       ├── context.py
│       ├── __init__.py
│       ├── Testing
│       │   └── Temporary
│       │       ├── CTestCostData.txt
│       │       └── LastTest.log
│       ├── tests.test
│       └── test_vehicle_controller.py
├── srv
│   └── ManipulatorPosition.srv
└── Testing
    └── Temporary
        ├── CTestCostData.txt
        └── LastTest.log

I don't see what I'm doing wrong here

edit:

my test_vehicle_controller.py looks like this

#!/usr/bin/env python
import unittest
PKG = 'my_pkg'
import roslib; roslib.load_manifest(PKG)

class AdvancedTestSuite(unittest.TestCase):
    """Advanced test cases."""

    def test_thoughts(self):
        self.assertIsNone(None)


if __name__ == '__main__':
    import rostest
    rostest.rosrun(PKG, 'test_vehicle_controller', AdvancedTestSuite)
edit retag flag offensive close merge delete

Comments

Is test_vehicle_controller.py executable? Does it have the x bit set in ls -al test_vehicle_controller.py?

gvdhoorn gravatar image gvdhoorn  ( 2017-11-14 07:01:34 -0500 )edit

yes it does (-rwxr-xr-x). I have the feeling that the path is not correct, but I have no idea what I need to change

Westranger gravatar image Westranger  ( 2017-11-14 07:05:53 -0500 )edit

after a reboot every thing works as expected

Westranger gravatar image Westranger  ( 2017-11-14 10:54:22 -0500 )edit

1 Answer

Sort by » oldest newest most voted
2

answered 2020-03-18 17:40:06 -0500

fjp gravatar image

updated 2020-03-19 02:57:17 -0500

When using catkin-tools you have to execute

catkin build pkg_name --catkin-make-args run_tests

Then the tests can be executed using

rostest pkg_name test_file.test

See also the catkin documentation for building and running tests

To run a catkin test for a specific catkin package, from a directory within that package:

catkin run_tests --no-deps --this

See also this answer using catkin_make.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-11-14 06:48:52 -0500

Seen: 2,991 times

Last updated: Mar 19 '20