Issue
I use junit5 and have two classes with integrations tests FooIT
and TestBarIT
. This is my configuration
@RunWith(JUnitPlatform.class)
@SelectClasses({
FooIT.class, TestBarIT.class
})
@SuiteDisplayName("Suite IT")
public class SuiteIT { }
However, tests in FooIT
will be ignored if I don't add word Test
(for example TestFooIT
). But I don't want to add word Test
as we have a strict naming convention for tests.
Can anyone say how to make junit suite accept classes without Test
in their names or to configure it use IT
for class checking?
Solution
I got the answer from JUnit team.
The @IncludeClassNamePatterns and @ExcludeClassNamePatterns annotations are designed explicitly for that purpose.
So,
@RunWith(JUnitPlatform.class)
@SelectClasses({
FooIT.class, BarIT.class
})
@SuiteDisplayName("Suite IT")
@IncludeClassNamePatterns(".*IT$")
public class SuiteIT { }
Answered By - Pavel_K