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

Rostest succeeds test if a node crashes

asked 2019-07-01 15:04:59 -0600

okalachev gravatar image

updated 2019-07-01 15:05:28 -0600

If a node in a test-case crashed, rostest doesn't care about it, and succeeds the testcase.

For example:

$ rostest somepkg basic.test
... logging to /home/parallels/.ros/log/rostest-parallels-vm-6224.log
[ROSUNIT] Outputting test results to /home/parallels/.ros/test_results/somepkg/rostest-test_basic.xml
Traceback (most recent call last):
  File "/home/parallels/catkin_ws/src/somepkg/src/fail.py", line 3, in <module>
    print 1/0
ZeroDivisionError: integer division or modulo by zero
[Testcase: testbasic_test] ... ok

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

[clever.rosunit-basic_test/test_state][passed]

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

rostest log file is in /home/parallels/.ros/log/rostest-parallels-vm-6224.log

How to make rostest fail the test if a node crashes?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2019-07-04 14:47:27 -0600

okalachev gravatar image

Actually, to make the nodes "required" is kind of a solution.

edit flag offensive delete link more
1

answered 2019-07-01 20:19:58 -0600

130s gravatar image

updated 2019-07-01 20:46:12 -0600

I can't tell for certain without looking at your test case definition, but the following error you're seeing is what fail.py (and/or underlining modules) returned, not your test case.

ZeroDivisionError: integer division or modulo by zero

Unless at least one of your test cases finish with certain error state, rostest passes.

Writing test cases is covered on wiki.ros.org/rostest.

edit flag offensive delete link more

Comments

Yeah, but it doesn't make sense. If one of my nodes just has fallen, why in the world we can consider that our tests are successful?

okalachev gravatar image okalachev  ( 2019-07-04 14:44:55 -0600 )edit

Actually, I found kind of solution, if a "required" node falls, then tests fall too. The only problem is that I don't want to make all of nodes "required" in my launch-files I want to test.

okalachev gravatar image okalachev  ( 2019-07-04 14:45:56 -0600 )edit

Question Tools

3 followers

Stats

Asked: 2019-07-01 15:04:59 -0600

Seen: 337 times

Last updated: Jul 04 '19