1

I have an integration test that fetches from a 3rd party API, I'd like to only run this test class manually, is there any way I can ignore the test unless an argument/parameter/env variables is passed? So I can run the test manually with my IDE, but have CI ignore it.

Worth saying that I have unit tests that test smaller portions of the workload that can always run.

xenoterracide
  • 16,274
  • 24
  • 118
  • 243
  • 1
    perhaps http://www.javacodegeeks.com/2015/01/separating-integration-tests-from-unit-tests-using-maven-failsafe-junit-category.html can help –  Feb 06 '15 at 16:20

1 Answers1

3

With Junit Assume:

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

    // add your @Test
}

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