It is increasingly hard to find situations where programs don't need to use some kind of parallelism. Most modern applications require concurrency and the full performance of modern hardware can only be exploited by concurrent programs. Despite this, most development tools don't support the unique challenges that parallel programming poses.
One of these challenges is the unit testing of parallel programs, where we expect the tests to be run multiple times, with different schedulings. This document explores this problem and provides a possible solution in the form of a concrete tool for Java programs.
Different schedules can be caused by inserting instructions into the program code that randomly slow the threads down. This is done by instrumentation. To decide where to insert the instructions, the Java Memory Model was used.
To determine how many times a test should be run, parallel coverage metrics are used. The metrics are based on parallel events or fault detection algorithms for parallel programs. Several parallel coverage metrics are presented and were implemented.
The tool uses a Java Agent for modifying the code under test and is integrated into the JUnit 4 testing framework. The solution is measured and it is concluded that it can be effectively used to detect faults in parallel programs.