mercredi 27 mai 2015

GMock and Catch.hpp Integration

I really like catch.hpp for testing (http://ift.tt/UTjgkv). I like its BDD style and its REQUIRE statements, its version of asserts. However, catch does not come with a mocking framework.

The project I'm working on has GMock and GTest but we've used catch for a few projects as well. I'd like to use GMock with catch.

I found 2 conflicts in the catch.hpp and gtests header files for the macros FAIL and SUCCEED. Since I'm not using the TDD style but instead the BDD style I commented them out, I checked that they weren't referenced anywhere else in catch.hpp.

Problem: Using EXPECT_CALL()... doesn't return anything or have callbacks to know if the EXPECT passed. I want to do something like: REQUIRE_NOTHROW(EXPECT_CALL(obj_a, an_a_method()).Times(::testing::AtLeast(1)));

Question: How can I get a callback if EXPECT_CALL fails (or a return value)

Aucun commentaire:

Enregistrer un commentaire