Question

I am integrating an external junit.framework.TestSuite into my library which is built using Maven and JUnit4. The typical tests, if not all of them, are kicked off using JUnit4 annotations. How do I incorporate a junit.framework.TestSuite into this existing test codebase?

Here's what I have tried so far:

public class JSR330Tck {
    @Test
    public junit.framework.Test suite(){
        Car car = Factories.get(CarFactory.class).buildCar();
        return Tck.testsFor(car, false, true);
    }
}

Or by defining it with a static suite() method:

public class JSR330Tck {
    public static junit.framework.Test suite(){
        Car car = Factories.get(CarFactory.class).buildCar();
        return Tck.testsFor(car, false, true);
    }
}

Both of these are not triggered via the Maven surefire plugin.

Était-ce utile?

La solution

I would assume that your test classes are not named based on the naming convention for test in relationship with maven-surefire-plugin

includes>
 <include>**/*Test*.java</include>
 <include>**/*Test.java</include>
 <include>**/*TestCase.java</include>
</includes>

Apart from that you shouldn't use TestSuites, cause surefire-plugin will handle that already. So usually there is no need to suites to be defined separately.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top