I'd like to run the JUnit tests in our project from the command line using an Ant target. Up until now we ran the tests manually from Eclipse without any issues using the embedded JUnit in Eclipse. After finally having figured out how the set the classpath I now get failed Tests for all classes that use the Parameterized Runner from JUnit 4.11. While running the test target (ant test) the only output is "FAILED" after the name of the Testclass, even with option -v. Generating testreports shows the following Exception:
java.lang.IllegalArgumentException: wrong number of arguments
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
What does this mean? The version are: - JDK 1.6 - ant 1.9.3 - JUnit 4.11
My build.xml is over 400 lines long so I'm not sure if it makes sense to post it here. Let me know if you need parts of the build.xml.
Update 13.05.2015: Here's a sample section from on of our JUnit Test classes that fail. The @Parameters section contains only one entry which is pretty useless in this case but this class still fails when run from ant.
@Parameters
public static Iterable<String[]> testData() {
return Arrays
.asList(new String[][] { { "a-rules-filename" } });
}
@Parameter
public String RULES_FILE_NAME;
Our Test class is annotated like this:
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@RunWith(Parameterized.class)
public class OurRulesTest {
@Parametersmethod and constructor). - Stefan Birkner