I have a spring-boot
application for which I am writing IT tests.
The data for the tests comes from application-dev.properties
when I activ
I wanted to exclude tests that required an external service but I couldn't get that to work the way I wanted (more or less a non-existent @IfNotProfileValue
).
As an alternative, I used the JUnit Assume.assumeThat which provided the behavior I wanted. e.g.,
Assume.assumeThat("Skipping Test: No username property", this.username, not(isEmptyString()));
I ended up not using a profile to drive it but you should be able to define a property or use the Environment to determine if a profile is active.
The assumeThat
can be used in @Test
and @Before
methods but be aware that the @After
methods will still run so cleanup might need a code guard.