[mocha-developer] Problem with Mocks: "random" tests failing

James Mead jamesmead44 at gmail.com
Tue Jul 10 05:38:49 EDT 2007


I suspect this is due to the fact that exceptions raised in one thread
are not caught in another. Mocha was not designed to test across
multiple threads. In general it is not a good idea to do
multi-threaded unit testing.

You need to separate out the multi-threaded concern of the code so you
can unit test the logic in a single thread. There is an excellent
article on the JMock site (http://www.jmock.org/threads.html) that
should explain this better - don't be put off by the fact the examples
are in Java - they are very readable.

If you are still stuck - perhaps you can do as David suggests and send
us a chunk of sample code that you are having difficulty testing.
-- 
James.
http://blog.floehopper.org


More information about the mocha-developer mailing list