lundi 20 août 2018

JUnit: is it possible to create a Test Suite that executes all test of classes that share a naming convention?

I am aware that I can make a TestSuite enumerating all the classes that I want, for example:

@RunWith(Suite.class)
@SuiteClasses({SQLServerTests1.class, SQLServerTest2.class, ... })
public class AllSQLServerTests {}

However I have almost 100+ classes and I don't want to have to remember to include any new one in the @SuiteClasses annotation.

As my classes have a naming convention (starting with "SQLServer" for example) I am searching for a way to do something like this:

@RunWith(Suite.class)
@SuiteClasses(prefix="SQLServer")
public class AllSQLServerTests {}

is it possible with plain JUnit? with spring or any other framework?

Aucun commentaire:

Enregistrer un commentaire