Ask Your Question
2

gtest not showing failure message [closed]

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

BennyRe gravatar image

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

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 imagevhwanger ( 2013-11-10 12:39:42 -0600 )edit

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

BennyRe gravatar imageBennyRe ( 2013-11-11 23:39:55 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

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

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

Question Tools

1 follower

Stats

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

Seen: 733 times

Last updated: Sep 12 '13