CPPUTEST:如何忽略仅在其他电话之间放置一个嘲笑的电话 [英] CPPUTEST: How to ignore only one mocked call placed between other ones
问题描述
我想忽略在同一个案例测试下我想打电话的其他电话之间的一个电话。如果我使用ignoreothercalls,我还没有清楚,其余的调用,接下来,将被调用。我需要休息,经过忽略的电话,将被调用。或者至少要在测试用例结束之前找到停止忽略对等效果的方法。
I would like to ignore one call placed between other ones that I want to call under the same case test. If I use ignoreothercalls I have not clear if the rest of the calls, following this, will be called. I need the rest, after ignored call, will be called. Or at least, to find the way of stopping ignoreothercalls effect before the end of the test case.
TEST(group, test1){
...
mock().expectOneCall("HAL_AS393x_CommandStrobes").withParameter("cCommandCode",AS393X_CMD_CALIB_RCO_LC);
/*-------------------------------------------------------*/
mock().expectOneCall("HAL_AS393x_ReadRegisters");//I want ignore only this mocked function call
/*-------------------------------------------------*/
mock().expectOneCall("HAL_AS393x_Deinit");
...
}
我想离开此调用未经测试,并将其从de测试用例中除去,而gettig则期待其调用错误:
mock()。 xxxCall (HAL_AS393x_ReadRegisters); // - 其中 xxxCall =用于此的unkown关键字 -
I would like to leave this call without being tested, and remove it from de test case without gettig expecting calls errors for it: mock().xxxCall("HAL_AS393x_ReadRegisters"); //-where xxxCall = unkown keyword used for this-
推荐答案
您必须检查期望之间:
mock().expect...
do_something_that_call_mocks();
mock().checkExpectations();
/* Start all over again */
使用checkExpectations )以重置mock()这里
Complete example using checkExpectations() to reset mock() here
这篇关于CPPUTEST:如何忽略仅在其他电话之间放置一个嘲笑的电话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!