Discussion of testing theory and practice, including methodologies (such as TDD, BDD, DDD, Agile, XP) and software - anything to do with testing goes here. (Formerly "The Testing Side of Development")
I can make an expectation about a single call with a known set of arguments. I can make an expectation about a minimum, maximum of fixed call count on a method. I can make an expectation about the arguments given at a known call time on a method. But how can I more broadly just say that I expect method A to be called 3 times with argument B? The method may be called any number of times with other arguments but only 3 times with these certain arguments.
I can't see a way to do it without committing myself to the exact time it will be called using expectAt(..)... I'll do this but it feels a bit too likely to break as the code evolves even if technically what's happening is correct. Is it possible to do what I want?
Maugrim_The_Reaper wrote:I think this is one for the SimpleTest mailing list - or a lot of source code reading...
Well I had a poke around and found that essentially things like expectOnce() and expect() all just operate by running combinations of the other expectations. For example, expectOnce() with expect arguments just calls expect() right after it's checked if expectCallCount(..., 1) is ok.
The problem with what I was looking to do is that none of the methods already there actually have the ability to do what I need. That said, all the data is stored nicely so it would be easy to "hack" it in. I may have a look at changing expectCallCount() to allow an argument expectation to be given purely for my own interest