Hello there, and thanks for JUnit! 👋
My team has recently migrated to JUnit 5, and previously we were previously using the junit-hierarchicalcontextrunner for nested tests.
One big difference from that one is that on JUnit 5 the native nested tests require that nested classes be annotated with the @Nested annotation.
We've now been using it for a few weeks, and my team found that sometimes we forget to add an @Nested annotation to an inner class.
This leads to a test suite that is apparently green, but that in reality is missing tests, and is hard to spot.
Would it be possible to either:
-
add a validation that would warn us that we could possibly be missing @Nested -- by for instance detecting that a nested class had JUnit annotations on it but would not be executed
-
have a mode/option/top-level annotation for executing tests in nested classes without needing an explicit @Nested
Thanks! 🙏
Related issues
Hello there, and thanks for JUnit! 👋
My team has recently migrated to JUnit 5, and previously we were previously using the junit-hierarchicalcontextrunner for nested tests.
One big difference from that one is that on JUnit 5 the native nested tests require that nested classes be annotated with the
@Nestedannotation.We've now been using it for a few weeks, and my team found that sometimes we forget to add an
@Nestedannotation to an inner class.This leads to a test suite that is apparently green, but that in reality is missing tests, and is hard to spot.
Would it be possible to either:
add a validation that would warn us that we could possibly be missing
@Nested-- by for instance detecting that a nested class had JUnit annotations on it but would not be executedhave a mode/option/top-level annotation for executing tests in nested classes without needing an explicit
@NestedThanks! 🙏
Related issues