Hi The Construct team,
I just finished the chapter “ROS Integration Tests” of this course Unit Testing with ROS.
When I execute exercise 4.3, the result / output shows that the test failed.
Should the test fail or pass?
This is my output:
user:~/catkin_ws$ rostest robot_control rotate_robot_integration_test.test
... logging to /home/user/.ros/log/rostest-1_xterm-12497.log
[ROSUNIT] Outputting test results to /home/user/.ros/test_results/robot_control/rostest-test_rotate_robot_integration_test.xml
Clockwise
Traceback (most recent call last):
File "/home/user/catkin_ws/src/robot_control/src/robot_control/rotate_robot_srv_client.py", line 20, in <module>
result = rotate_robot_service(rotate_robot_object)
File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 435, in __call__
return self.call(*args, **kwds)
File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 523, in call
raise rospy.exceptions.ROSInterruptException("node shutdown interrupted service call")
rospy.exceptions.ROSInterruptException: node shutdown interrupted service call
Traceback (most recent call last):
File "/home/user/catkin_ws/src/robot_control/src/robot_control/reset_world_client.py", line 10, in <module>
rospy.wait_for_service('/gazebo/reset_world')
File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 159, in wait_for_service
raise ROSInterruptException("rospy shutdown")
rospy.exceptions.ROSInterruptException: rospy shutdown
[Testcase: testrotate_robot_integration_test_ex] ... ok
[ROSTEST]-----------------------------------------------------------------------
[robot_control.rosunit-rotate_robot_integration_test_ex/test_correct_rotation][FAILURE]
Integration error. Rotation was not between the expected values.
File "/usr/lib/python2.7/unittest/case.py", line 329, in run
testMethod()
File "/home/user/catkin_ws/src/robot_control/test/rotate_robot_integration_test_ex.py", line 44, in test_correct_rotation
"Integration error. Rotation was not between the expected values.")
File "/usr/lib/python2.7/unittest/case.py", line 422, in assertTrue
raise self.failureException(msg)
--------------------------------------------------------------------------------
SUMMARY
* RESULT: FAIL
* TESTS: 1
* ERRORS: 0
* FAILURES: 1
rostest log file is in /home/user/.ros/log/rostest-1_xterm-12497.log
Here is my rotate_robot_integration_test.test
file:
<launch>
<node pkg="robot_control"
type="reset_world_client.py"
name="reset_world_service_client"
output="screen"/>
<node pkg="robot_control"
type="rotate_robot_srv.py"
name="robot_control_node"
output="screen"/>
<node pkg="robot_control"
type="rotate_robot_srv_client.py"
name="rotate_robot_service_client"
output="screen"/>
<test pkg="robot_control"
type="rotate_robot_integration_test_ex.py"
test-name="rotate_robot_integration_test_ex"/>
</launch>
Thanks,
Girish