Status Quo
Using JUnit 5 annotations and mechanisms one can do a lot of things that are syntactically possible but don't make sense. For example, one can annotate a method with both @Test and @BeforeEach.
Proposal
Introduce a mechanism where JUnit itself but also other parties can register rules that will be checked during discovery time, e.g.:
AmbiguousAnnotationsRule
DuplicateExtensionsRule
ProhibitNestedTestsRule (in case a project wants to forbid this style of testing)
Those rules should be listable and configurable from the launcher API: Error, Warning, Off
Rules could work on different level, e.g whole test plan, engine, package, class, method, etc.
Related Issues
Status Quo
Using JUnit 5 annotations and mechanisms one can do a lot of things that are syntactically possible but don't make sense. For example, one can annotate a method with both
@Testand@BeforeEach.Proposal
Introduce a mechanism where JUnit itself but also other parties can register rules that will be checked during discovery time, e.g.:
AmbiguousAnnotationsRuleDuplicateExtensionsRuleProhibitNestedTestsRule(in case a project wants to forbid this style of testing)Those rules should be listable and configurable from the launcher API: Error, Warning, Off
Rules could work on different level, e.g whole test plan, engine, package, class, method, etc.
Related Issues