Java micro-library for writing & testing concurrent code
Intermittent Tests
As much as possible, you aim to have a completely deterministic tests but despite your best efforts, the odd flickering test can still get through. Occasionally, you might want to run such a test repeatedly to get an idea of its indeterminacy. The Intermittent annotation can be combined with the IntermittentTestRunner to provide this behaviour along side junit.
You simply mark a junit test method (or class) as potentially intermittent using the Intermittent annotation as follows.
12345
@Test@Intermittentpublicvoidflickering(){// ...}
You can then use the @RunWith annotation to run the test using the IntermittentTestRunner. Any @Before or @After methods will be run once for each test repetition. The example below also shows that the repetition count can be overridden on the method annotation.