Closed GoogleCodeExporter closed 9 years ago
because mockcpp report failures by exception, but gtest doesn't caught it.
now, you can use mockcpp with gtest, but if some test failure, the other tests
may not run.
I suggest you use testngpp instead of gtest.
http://code.google.com/p/test-ng-pp
or use cpp-ut-project integrated solution:
http://code.google.com/p/cpp-ut-project
see also:
http://code.google.com/p/cpp-project/
Original comment by sinoje...@gmail.com
on 4 Jun 2011 at 3:01
mockcpp maybe can not works well with gtest shipped with mockcpp-samples,
however, it do works with gtest 1.6.0.
I think this can be marked as solved.
the result is as follow:
Running main() from gtest_main.cc
[==========] Running 2 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 2 tests from TestApiHook
[ RUN ] TestApiHook.test_api_hook_ok
[ OK ] TestApiHook.test_api_hook_ok (1 ms)
[ RUN ] TestApiHook.test_api_hook_fail
/home/james/ExtDir/share/MockFramework/mockcpp-samples/gtest-samples/../tools/mo
ckcpp/include/mockcpp/ChainableMockMethod.h:69: Failure
=====================================
Unexpected invocation: the invocation cannot be found in allowed invoking list.
Invoked: add((int)0x1/1, (int)0x2/2)
Allowed:
method(add)
.expects(once())
.invoked(0)
.with(eq((int)0x2/2), eq((int)0x3/3))
.will(returnValue((int)0x14/20));
=====================================
unknown file: Failure
C++ exception with description "failed due to mockcpp exception" thrown in the
test body.
[ FAILED ] TestApiHook.test_api_hook_fail (0 ms)
[----------] 2 tests from TestApiHook (1 ms total)
[----------] Global test environment tear-down
[==========] 2 tests from 1 test case ran. (1 ms total)
[ PASSED ] 1 test.
[ FAILED ] 1 test, listed below:
[ FAILED ] TestApiHook.test_api_hook_fail
1 FAILED TEST
Original comment by col...@gmail.com
on 7 Jun 2011 at 1:34
Original comment by sinoje...@gmail.com
on 2 Oct 2011 at 2:40
Original issue reported on code.google.com by
col...@gmail.com
on 3 Jun 2011 at 10:13