thurn / asynctest

A simple base class for writing asynchronous JUnit 4 tests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AsyncTest is a simple helper for writing asynchronous JUnit test cases. To use it, simply extend AsyncTestCase for your JUnit 4 test case. At the start of your test (or at least, at the start of the asynchronous portion of it), call beginAsyncTestBlock(). At the end, call endAsyncTestBlock(). Then, in your test, call finished() when some asynchronous operation has completed. You can also pass a number to beginAsyncTestBlock() to indicate the number of calls to finished() you are expecting.

By default, AsyncTest waits 10 seconds for calls to finished(), but this can be changed via a constructor parameter. It also adds a global UncaughtExceptionHandler to propagate uncaught exceptions thrown by your test code back to the main thread. This functionality can be changed via a constructor parameter as well.

About

A simple base class for writing asynchronous JUnit 4 tests

License:Other


Languages

Language:Java 94.2%Language:Groovy 5.8%