Is there a way to conditionally ignore a test with JUnit Spring?

I have an integration test that is extracted from a third-party API, I would only like to run this test class manually, is there a way to ignore the test if the parameter / parameter / env variables are not passed? Therefore, I can run the test manually using my IDE, but CI will ignore it.

It is worth saying that I have unit tests that check the smaller parts of the workload that can always be executed.

0
java spring junit
source share
1 answer

With Junit Assume :

 public class SomeTest { @Before public void before() throws Exception { Assume.assumeTrue("someValue".equals(System.getProperty("some.property"))); } // add your @Test } 

You can also use @IfProfileValue for tests using spring junit runner

+2
source share

All Articles