lundi 18 septembre 2017

Maven not finding tests from a test suite class

I am using maven to run a series of junit tests, I have changed the code so that instead of using @Test annotations I use a test suite class like this:

public class MyTests {
  public static Test suite() {
    TestSuite ts = new TestSuite("My Test Suite");
    ts.addTest(new CustomTestCase1("Test 1"));
    ts.addTest(new CustomTestCase2("Test 2"));
    ...
    return ts;
  }
}

When I run a

mvn clean -U -fn -Dtest=MyTests test

I get a No tests were executed!

Can anybody point me to how I could run the test using maven instead of creating a test runner for each class?

Thanks

Aucun commentaire:

Enregistrer un commentaire