I'd like some tests enabled only for specified profiles, for example:
@SpringJUnitConfig
abstract class TestBase {
@Profile("foo")
@Test
void test_only_run_with_profile_foo() {
}
@Profile("bar")
@Test
void test_only_run_with_profile_bar() {
}
}
@ActiveProfiles("foo")
class FooTests extends TestBase {
}
@ActiveProfiles("bar")
class BarTests extends TestBase {
}
There is a workaround but not elegant: @EnabledIf(value = "#{environment.matchesProfiles('foo')}", loadContext = true)
Comment From: sbrannen
Closing as a:
- duplicate of #20849