Is it possible to mark springboot tests so they run only when certain profile is active

My colleague found a solution: so if you need to annotate separate tests you can use the @IfProfileValue annotation:

@IfProfileValue(name ="spring.profiles.active", value ="default")
    @Test
    public void testSomething() {
        //testing logic
    }

This test will run only when default profile is active


Yes you can do it.

For example use @ActiveProfiles:

@ActiveProfiles("default")
@RunWith(SpringRunner.class)
@SpringBootTest
public class YourTest {
   //tests
}