ignoreAdditionalCalls (ignoreMultipleCalls?)#973
ignoreAdditionalCalls (ignoreMultipleCalls?)#973maxilai wants to merge 1 commit intocpputest:masterfrom
Conversation
|
I'm somewhat uncomfortable with this feature as I don't know in what case you would want to use it. Could you explain that to me? It feels it opens the door to making a lot weaker tests. |
|
Thanks for your feedback ! The thing is. In they test cases, they call a mocked function many times. With ignoreOtherCalls and ignoreAdditionCalls, programmers will be able to Or, do you guys have any good suggestion? Thanks! 2016-05-20 9:44 GMT+08:00 Bas Vodde notifications@github.com:
|
|
As a matter of interest, how do they determine pass / fail? I assume they have some way to check the value of One thing I don't really understand is, if the first N calls influence the value of Would it solve their problem if they set default return values for these mocks and then used |
|
@maxilai It feels a bit like a hack to patch poorly written unit tests, so I'm very hesitant to add it. Even if we would add it, the way it is suggested now is generic so that it is for all expectations. That would make even less sense as you mentioned the ignoreAdditional calls ought to be per function. I'd love to hear others opinion, but for me so far, it feels a bit wrong. Perhaps you could come up with an actual concrete test, so we could look at that? |
|
Thanks for the advice from all of you. |

Hi, basvodde and arstrube
My colleagues raised an requirements for "ignore additional (multiple, extra) calls".
Here, we have ignoreOtherCalls which does not ignore the expected one.
Then, we add a feature ignoreAdditionalCalls which behaviors like below. What I concern is the name "ignoreAdditionalCalls". Is this name a good one?
Thanks!
TEST(MockCallTest, ignoreAdditionalCallsExceptForTheExpectedOne)
{
mock().expectOneCall("foo");
mock().ignoreAdditionalCalls();
mock().actualCall("foo");
}