[zeromq-dev] Testing and debugging

Michel Pelletier pelletier.michel at gmail.com
Wed Aug 15 21:00:39 CEST 2012


On Wed, Aug 15, 2012 at 2:50 AM, andrea crotti
<andrea.crotti.0 at gmail.com> wrote:
> 2012/8/14 Michel Pelletier <pelletier.michel at gmail.com>:
>>
> It's true that I don't need to test also zeromq and I could mock it,
> but is it worth since I could just as easily use it??

You can go either way, I like using flexmock (or other mock libs)
because they have all the expectation tools built in (once, with_args,
call ordering, etc) so I can write robust expectations about what my
code does, without rewriting that each time.  Also my mock tests end
up being ultra-focused, testing the one very specific thing I want to
test without any other moving parts involved.  This makes it really
fast as well, most of my unit tests suites end up zipping by in less
than a second which means I run them a lot.  The downside of that of
course is that when you do put all the parts together, your
expectations don't line up.  That's what I use integration tests for.

In any case the fact that you are testing your code at all is of
course the big win, how you go about it is more a matter of style than
anything.

-Michel



More information about the zeromq-dev mailing list