Hi Glenn,

On 16/11/11 23:47, Glenn Adams wrote:
> With the recent transition to JUnit4 runner and changes to
> LayoutEngineTestCase, it is now someone difficult to determine (from output
> data alone) which layoutengine test file failed when a regression occurs.
> In particular, the exception trace generated from EvalCheck, TrueCheck,
> etc. does not include the test case input file name. So one ends up with
> something like the following in
> the TEST-org.apache.fop.layoutengine.LayoutEngineTestCase.txt file in
> builds/test-reports:
> 
> Testcase: runTest[342] took 0.017 sec
>         Caused an ERROR

This is a known issue:
https://github.com/KentBeck/junit/issues/44
And quite popular at that it seems:
https://github.com/KentBeck/junit/issues/search?q=parameterized+name

In the meantime, I wrote the attached patch to IFParserTestCase. The
same could be done for LayoutEngineTestCase.

<snip/>
> 
> Unfortunately, there is no way to correlate runTest[342] with a specific
> test case input file. It would be very useful (for AT and IF tests) to also
> include the test case input file name/path in this output. Otherwise, one
> is forced to run junit in a debugger with a breakpoint on EvalCheck,
> TrueCheck, etc.

Vincent
Index: test/java/org/apache/fop/intermediate/IFParserTestCase.java
===================================================================
--- test/java/org/apache/fop/intermediate/IFParserTestCase.java	(revision 1187300)
+++ test/java/org/apache/fop/intermediate/IFParserTestCase.java	(working copy)
@@ -48,6 +48,9 @@
 @RunWith(Parameterized.class)
 public class IFParserTestCase extends AbstractIFTestCase {
 
+    /** Set this to true to get the correspondence between test number and test file. */
+    private static final boolean DEBUG = false;
+
     /**
      * Gets the parameters for this test
      *
@@ -56,9 +59,21 @@
      */
     @Parameters
     public static Collection<File[]> getParameters() throws IOException {
-        return LayoutEngineTestUtils.getLayoutTestFiles();
+        Collection<File[]> testFiles = LayoutEngineTestUtils.getLayoutTestFiles();
+        if (DEBUG) {
+            printFiles(testFiles);
+        }
+        return testFiles;
     }
 
+    private static void printFiles(Collection<File[]> files) {
+        int index = 0;
+        for (File[] file : files) {
+            assert file.length == 1;
+            System.out.println(String.format("%3d %s", index++, file[0]));
+        }
+    }
+
     /**
      * Constructor for the test suite that is used for each test file.
      * @param testFile the test file to run

Reply via email to