I have two different sets of parameter sources for a parameterized test (set 1 being a subset of set 2). Depending on JUnit5 tags I want to execute the same test method either against set 1 or set 2.
Unfortunately neither the annotation @ParameterizedTest nor @MethodSource allow to specify a tag.
Obviously I can define two different test methods which have the same functionality but act on different parameter sets but that is very redundant/verbose. Isn't there a more elegant way?
TestInfoparameter to your@MethodSource, it will be automatically resolved. You can then checktestInfo.getTags().contains(...). Note that since@MethodSourceisstatic, this will only work for tags on the class level. But anyway, would you mind adding some sample code?