[zeromq-dev] Testing framework

Staffan Gimåker staffan at spotify.com
Mon Jan 23 17:24:32 CET 2012

On Tue, 2012-01-24 at 03:02 +1100, john skaller wrote:
> On 24/01/2012, at 2:02 AM, Staffan Gimåker wrote:
> >> 
> >> My belief here: for systems like 0MQ units tests are all but worthless.
> >> The behaviour of the functions depends critically other functions,
> >> so you can't really test any of them independently. Worse, you cannot
> >> test communications and asynchronous behaviour with an isolated
> >> subroutine.
> > 
> > I don't disagree that automated or semi-automated
> > integration/performance tests would be nice to have, BUT unit tests have
> > a role to fill as well.
> > 
> > Traditional unit tests work perfectly well for detecting a lot of errors
> > (the easy ones). For example, it's a good fit to test that filtering
> > works as it should or that someone didn't accidentally break the REQ-REP
> > functionality.
> Yes but that isn't a unit test. It's an integration test :)
> You need at least two threads to do it, probably two processes.

For the filtering example, you could test that separately if you wanted
to. And you only need one thread (+ 1 io thread) to do tests on an
actual socket level.

For example, look at tests/test_sub_forward.cpp.

No matter if you want to call that an integration test or a unit test
that's still a case where a typical unit testing framework is a
sufficient tool.


More information about the zeromq-dev mailing list