11/*******************************************************************************
2- * Copyright (c) 2000, 2022 IBM Corporation and others.
2+ * Copyright (c) 2000, 2026 IBM Corporation and others.
33 *
44 * This program and the accompanying materials
55 * are made available under the terms of the Eclipse Public License 2.0
4545import org .osgi .framework .FrameworkUtil ;
4646
4747/**
48- * A TestRunner for JUnit that supports Ant JUnitResultFormatters and running
49- * tests inside Eclipse. Example call: EclipseTestRunner -classname
50- * junit.samples.SimpleTest
51- * formatter=org.apache.tools.ant.taskdefs.optional.junit
52- * .XMLJUnitResultFormatter
48+ * A TestRunner for JUnit that supports running tests inside Eclipse. Example
49+ * call: EclipseTestRunner -classname junit.samples.SimpleTest -resultPath
50+ * result.xml
5351 */
5452public class EclipseTestRunner {
5553
@@ -73,15 +71,13 @@ public class EclipseTestRunner {
7371 * <pre>
7472 * -className=<testSuiteName>
7573 * -testPluginName<containingpluginName>
76- * -formatter= <classname>(,< path>)
74+ * -resultPath <path>
7775 * </pre>
7876 *
79- * Where <classname> is the formatter classname, currently ignored as only
80- * LegacyXmlResultFormatter is used. The path is either the path to the result
81- * file and should include the file extension (xml) if a single test is being
82- * run or should be the path to the result directory where result files should
83- * be created if multiple tests are being run. If no path is given, the standard
84- * output is used.
77+ * The result path is either the path to the result file and should include the
78+ * file extension (xml) if a single test is being run or should be the path to
79+ * the result directory where result files should be created if multiple tests
80+ * are being run. If no path is given, the standard output is used.
8581 */
8682 public static void main (String [] args ) throws IOException {
8783 System .exit (run (args ));
@@ -133,10 +129,11 @@ public static int run(String[] args) throws IOException {
133129 junitReportOutput = args [i + 1 ];
134130 }
135131 i ++;
136- } else if (args [i ].startsWith ("formatter=" )) {
137- String formatterString = args [i ].substring (10 );
138- int seperatorIndex = formatterString .indexOf (',' );
139- resultPathString = seperatorIndex == -1 ? null : formatterString .substring (seperatorIndex + 1 );
132+ } else if (args [i ].toLowerCase ().equals ("-resultpath" )) {
133+ if (i < args .length - 1 ) {
134+ resultPathString = args [i + 1 ];
135+ }
136+ i ++;
140137 } else if (args [i ].startsWith ("propsfile=" )) {
141138 try (FileInputStream in = new FileInputStream (args [i ].substring (10 ))) {
142139 props .load (in );
0 commit comments