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

gtest not showing failure message [closed]

asked 2013-09-10 22:42:12 -0500

BennyRe gravatar image

updated 2013-09-12 02:54:26 -0500

Hey,

I wrote some unit tests for my code. Unfortunately, if a test fails I am not getting the failure message, that I defined like this:

EXPECT_DOUBLE_EQ(0.009, min) << "Min value of row 0 not  equal 0.009";

I run the tests in the package directory with:

make test

The output looks like this:

[==========] Running 4 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 4 tests from TestSuite
[ RUN      ] TestSuite.testGetMinMax
runTest ... FAILURE!
FAILURE: test [test_ndmaptest] did not generate test results
  File "/usr/lib/python2.7/unittest/case.py", line 327, in run
    testMethod()
  File "/opt/ros/groovy/lib/python2.7/dist-packages/rosunit/baretest.py", line 169, in runTest
    self.assert_(os.path.isfile(test_file), "test [%s] did not generate test results"%test_name)
  File "/usr/lib/python2.7/unittest/case.py", line 420, in assertTrue
    raise self.failureException(msg)

This error message is printed:

FAIL() << "data_error exception!";

Is this the normal behavior of gtests in ROS or am I simply missing something?

Full source of the test here. I am using Ubuntu 12.04 with Groovy. It's a dry package.

Also a failed EXPECT_* seems to abort the tests. If I understand the documentation correctly only ASSERT_* should abort the tests.

Thanks in advance.

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by BennyRe
close date 2015-07-01 09:24:05.383127

Comments

I'm also having this issue right now. Did you find a solution?

vhwanger gravatar image vhwanger  ( 2013-11-10 12:39:42 -0500 )edit

Unfortunately no. It would be great if you post a solution if you find one.

BennyRe gravatar image BennyRe  ( 2013-11-11 23:39:55 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2015-02-10 19:17:05 -0500

Tom Moore gravatar image

I had this issue, and I fixed it by removing a call to ROS_ASSERT that was within one of my tests. It was the wrong macro to use, but I have a feeling that using any kind of ASSERT macro (which probably calls assert() at some point) is related to this issue.

edit flag offensive delete link more

Comments

I had the same problem and removing ROS_ASSERT helped me get rid of the problem.

vinaykumarhs2020 gravatar image vinaykumarhs2020  ( 2021-01-07 21:53:08 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2013-09-10 22:42:12 -0500

Seen: 2,310 times

Last updated: Sep 12 '13