Robotics StackExchange | Archived questions

gtest not showing failure message

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.

Asked by BennyRe on 2013-09-10 22:42:12 UTC

Comments

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

Asked by vhwanger on 2013-11-10 13:39:42 UTC

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

Asked by BennyRe on 2013-11-12 00:39:55 UTC

Answers

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.

Asked by Tom Moore on 2015-02-10 20:17:05 UTC

Comments

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

Asked by vinaykumarhs2020 on 2021-01-07 22:53:08 UTC