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
I'm afraid there is not such annotation in JUnit.
Is it really time consuming to add @Test on each method?
Maybe you could use your IDE auto generate tools to generate test methods for you, see for example:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With