Is there any @Test
-related annotation in the JUnit Jupiter API that allows us to highlight the whole test class as a testing class?
Since each test method needs to be annotated with @Test
, this would save some time when writing tests within test classes that do not include non-test methods.
No, back in 2019 the JUnit team decided against a class-level @Test
annotation:
There are many ways to declare tests in Jupiter:
@Test
,@TestFactory
,@TestTemplate
(@RepeatedTest
,@ParameterizedTest
) -- we want them to be explicitly visible and not rely on a pattern that matches a method signature.
https://github.com/junit-team/junit5/issues/1761#issuecomment-466149986