This documentation is for Clover 3.2.x View the latest version of

Unknown macro: {spacejump}

or visit the current Clover documentation home page.

Detection of test methods

Clover is able to detect test methods for following test frameworks and code patterns.

JavaDoc tags

This approach can be used for Java 1.4, which does not support annotations. In such case, test methods can be marked using JavaDoc tags:

TestNG style

/** @testng.test */
class MyTest {
    /** @testng.test */
    void myTestMethod()  { }
} 

JUnit style

/** @test */
void myTestMethod() { }

JUnit3

Methods with a following signature:

public void test***()

JUnit4

Methods annotated with one of the following:

@junit.org.Test(expected={Foo.class})
@junit.org.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)

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.

 

  • No labels