Skip to content

Threadly Features, Unit Testing

Mike Jensen edited this page Feb 11, 2020 · 1 revision

Return to the top level features page here:

Concurrent Unit Test Tools

  • AsyncVerifier

Used to verify operations which occurred asynchronously. The AsyncVerifier allows you to assert failures/successes in other threads, and allow the main test thread to throw exceptions if any failures occur. Thus blocking the main test thread until the sub-threads have completed.

  • TestableScheduler

This is very similar to NoThreadScheduler, except it allows you to supply the time, thus allowing things to happen faster than real time. If you have an implementation with a recurring task and you want to unit test what happens when it runs the 5th time, while keeping the unit test fast, you can supply a time faster than real time to cause these executions.

  • TestCondition

Often times in doing unit test for asynchronous operations you have to wait for a condition to be come true. This class gives a way to easily wait for those conditions to be true, or throw an exception if they do not happen after a given timeout. The implementation of TestRunnable gives a good example of how this can be used.

  • TestRunnable

A runnable structure that has common operations already implemented. It gives two functions handleRunStart() and handleRunFinish() to allow people to optionally override to provide any test specific operation which is necessary. You can see many examples in our own unit test code of how we are using this.