Deterministic Unit Tests for Multi-Threaded Java
No more untested multi-threaded Java. Use the open-source tool VMLens to write deterministic unit tests. Simply surround your multi-threaded, concurrent test with a loop iterating over all thread interleavings:
Got 10 minutes?
No More Untested Multi-Thread Java
No More Race Conditions
Race conditions occur when non-atomic methods are accessed by multiple threads simultaneously. The problem with detecting race conditions is that they only occur for very specific thread interlevings. B y executing all thread interleavings using VMLens, however, you can systematically test for race conditions.
No More Data Races
A data race occurs when memory access is not correctly synchronised. VMLens traces all synchronisation actions and memory accesses, checking that all memory accesses are correctly synchronised. This allows you to detect all data races during unit testing.
No More Deadlocks
A deadlock occurs when two threads attempt to acquire a lock that is being held by the other thread. Using VMLens to execute all thread interleavings allows you to check for data races during your tests in a deterministic way.
Why VMLens?
Documentation
The best way to document a class is to use tests. With VMLens, you can now demonstrate that a class is thread-safe by using unit tests. And you can document the result of calling two threads in parallel.
Debugging
The VMLens report shows all synchronisation actions and data races. This gives you an overview of the test run and helps you identify where to look for bugs. Since the tests are reproducible, you can then use logging or debugging to locate the bug.
TDD
Enabling unit tests for multi-threaded Java means that you can now use test-driven design to develop multi-threaded Java applications. Begin by writing the tests to define the desired behaviour of the class, then develop your classes using TDD.
Refactoring
It is terrible to refactor without tests. However, with deterministic unit tests, you can now refactor multi-threaded Java code without fear of breaking anything.
Open Source
VMLens is open source and is completely free for commercial use. It is licensed under Apache License 2.0