0

Currently, I am using GMock without GTest ( specifically, I'm using it with mstest ). Is there any way to get a string of the failed expectations ?

IE:

EXPECT_CALL( mockObject, MethodWith3Params( 1, 2, 3 ) ).Times(1);

// Do does not call MethodWith3Params at all.
stuffDoer.Do( mockObject);

Assert::IsTrue( Mock::VerifyAndClearExpectations( &mockObject ), " "/*What can I do here to say what expectation/s failed ?*/ );

I assume GMock is storing these strings ( or at least raw data that can be used to deduce a message ) somewhere, since GTest is able to tell you when an expectation isn't met.

4

1 に答える 1

1

から継承するクラスを作成し::testing::EmptyTestEventListener、テスト内でインスタンス化する必要があります。Google Test アドバンス ガイドを参照してください。

https://github.com/google/googletest/blob/master/docs/advanced.md#extending-googletest-by-handling-test-events

于 2013-10-10T20:39:55.297 に答える