I have several test classes annotated with @RunWith and @ContextConfiguration.
I use the following dependencies in my maven SpringBoot project:
<dependency>
<groupId>org.springframework.batch</groupId>
<artifactId>spring-batch-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
and when I run mvn clean verify it executes all my test classes.
Now I have a specific test class that I want to ignore during the verify phase.
I tried to annotate it with @ConditionalOnProperty, so at the end the class is as following:
@RunWith(SpringRunner.class)
@ContextConfiguration(classes = { RestTemplate.class, AvailabilityService.class, VerifyService.class,ConfirmService.class })
@ComponentScan(basePackages = "it.alpitour")
@TestPropertySource("classpath:application-test.properties")
@ConditionalOnProperty("test.api.real.run")
public class ToIgnoreTest {
so I have added a property inside my application-test.properties file:
test.api.real.run=false
but the test is still executed and not ignored, during the verify phase.
How can I skip it?
Thanks
edit:
I prefer not to use @Ignore because I need at some point to run that specific test manually.
What I just need is to exclude that one when all the other tests are running.