I am using gradle to run JUnit tests. The problem is that I need to pass arguments from the command line to tests. I tries to pass System properties but failed.
gradle test -Darg1=something
Here is my test:
public class MyTest {
@Test
public void someTest() throws Exception {
assertEquals(System.getProperty("arg1"), "something");
}
}
It fails because there is no arg1
argument.
Is it possible somehow to pass command line arguments?