Detection of test methods
Clover is able to detect test methods for following test frameworks and code patterns.
JUnit3
Methods with a following signature:
public void test***()
JUnit4
Methods annotated with one of the following:
@junit.org.Test
@Test
Also expected exceptions are understood, e.g.:
@Test(expected={Foo.class})
@Test(expected=Foo.class)
JUnit4+Spring
Methods annotated with:
@Test
@org.springframework.test.annotation.ExpectedException({Bar.class})
or
@Test
@ExpectedException(value={Bar.class})
TestNG
Methods annotated with one of the following:
@org.testng.annotations.ExpectedExceptions(Foo.class)
@ExpectedExceptions(org.bar.Foo.class)
@org.testng.annotations.Test(expectedExceptions={Foo.class})
@Test(expectedExceptions={Foo.class})
@org.testng.annotations.Test(expectedExceptions=Foo.class)
@Test(expectedExceptions=Foo.class)
JavaDoc tags
TestNG style
/** @testng.test */
class MyTest {
/** @testng.test */
void myTestMethod() { }
}
JUnit style
/** @test */
void myTestMethod() { }
Instinct
Methods annotated with one of the following:
@com.googlecode.instinct.marker.annotate.Specification(expectedException=Foo.class)
@Specification(expectedException=Foo.class)
Usage context
These patterns are being used by Clover for per-test coverage, test optimization and reporting.