Updated Branches:
  refs/heads/master 71f44f611 -> 93beca951

o Revised compact stacktrce format again.

Colon rules ;)


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/93beca95
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/93beca95
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/93beca95

Branch: refs/heads/master
Commit: 93beca951ced6946295fba350af703f667c36f5f
Parents: 71f44f6
Author: Kristian Rosenvold <krosenv...@apache.org>
Authored: Thu Dec 20 15:18:34 2012 +0100
Committer: Kristian Rosenvold <krosenv...@apache.org>
Committed: Thu Dec 20 15:18:34 2012 +0100

----------------------------------------------------------------------
 .../src/site/markdown/newerrorsummary.md           |   48 +++++----------
 .../surefire/report/SmartStackTraceParser.java     |   42 +++++++++---
 .../surefire/report/SmartStackTraceParserTest.java |   17 ++---
 3 files changed, 53 insertions(+), 54 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/93beca95/maven-surefire-plugin/src/site/markdown/newerrorsummary.md
----------------------------------------------------------------------
diff --git a/maven-surefire-plugin/src/site/markdown/newerrorsummary.md 
b/maven-surefire-plugin/src/site/markdown/newerrorsummary.md
index f33a2d6..98491ea 100644
--- a/maven-surefire-plugin/src/site/markdown/newerrorsummary.md
+++ b/maven-surefire-plugin/src/site/markdown/newerrorsummary.md
@@ -8,38 +8,20 @@ report of the run or the files on disk.
 ### Example output:
 
     Failed tests:
-      Test1#assertion1(59) Bending maths expected:<[123]> but was:<[312]>
-      Test1#assertion2(64) True is false
+      Test1.assertion1:59 Bending maths expected:<[123]> but was:<[312]>
+      Test1.assertion2:64 True is false
 
     Tests in error:
-      Test1#nullPointerInLibrary(38) >> NullPointerException
-      Test1#failInNestedLibInMethod(54).nestedLibFailure(72) >> 
NullPointerException
-      Test1#failInLibInMethod(48) >> NullPointerException
-      Test1#failInMethod(43).innerFailure(68) NullPointerException Fail here
-      Test2#test6281(33) RuntimeException FailHere
-
-The format of the report is quite "packed", so some explanation is required, 
there are three different formats:
-
-
-### Format 1, assertion failure.
-#### Class#method(line number)...methodN(lineN) "Assertion failure message"
-
-    Test1#assertion2(64) True is false
-    Test1#assertion1(59) Bending maths expected:<[123]> but was:<[312]>
-
-### Format 2, Exception in test.
-#### Class#method(line number)...methodN(lineN) Exception "Message"
-In this case the exception was actually thrown on the line in question.
-
-    Test1#failInMethod(43).innerFailure(68) NullPointerException Fail here
-    Test2#test6281(33) RuntimeException FailHere
-
-### Format 3: Exception in code called by test.
-#### Same format as 2 but >> added before exception
-In this case the exception is thrown inside some code that was called from 
this line of the
-test. We do not show where the actual exception happened, only which line(s) 
of the test
-that were involved in the call.
-
-    Test1#failInLibInMethod(48) >> NullPointerException
-    Test1#failInNestedLibInMethod(54).nestedLibFailure(72) >> 
NullPointerException
-
+      Test1.nullPointerInLibrary:38 » NullPointer
+      Test1.failInMethod:43->innerFailure:68 NullPointer Fail here
+      Test1.failInLibInMethod:48 » NullPointer
+      Test1.failInNestedLibInMethod:54->nestedLibFailure:72 » NullPointer
+      Test2.test6281:33 Runtime FailHere
+
+The main rules of the format are:
+ * Assertion failures only show the message
+ * Exception/Error is stripped from the Exception name to save space.
+ * The exception message is trimmed to an approximate 80 chars.
+ * The » symbol means that the exception happened below the method shown (in 
library code called by test)
+ * Methods in superclasses are normally shown as SuperClassName.methodName
+ * If the first method in the stacktrace is in a a superclass it will be show 
as this: TestClass>Superclass.method

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/93beca95/surefire-providers/common-java5/src/main/java/org/apache/maven/surefire/report/SmartStackTraceParser.java
----------------------------------------------------------------------
diff --git 
a/surefire-providers/common-java5/src/main/java/org/apache/maven/surefire/report/SmartStackTraceParser.java
 
b/surefire-providers/common-java5/src/main/java/org/apache/maven/surefire/report/SmartStackTraceParser.java
index 74b5c71..ebdfa40 100644
--- 
a/surefire-providers/common-java5/src/main/java/org/apache/maven/surefire/report/SmartStackTraceParser.java
+++ 
b/surefire-providers/common-java5/src/main/java/org/apache/maven/surefire/report/SmartStackTraceParser.java
@@ -22,6 +22,7 @@ package org.apache.maven.surefire.report;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
+import org.apache.maven.shared.utils.StringUtils;
 
 /**
  * @author Kristian Rosenvold
@@ -87,23 +88,28 @@ public class SmartStackTraceParser
             if ( i == 0 )
             {
                 result.append( simpleName );
-                result.append( "#" );
+                if ( !stackTraceElement.getClassName().equals( testClassName ) 
)
+                {
+                    result.append( ">" );
+                }
+                else
+                {
+                    result.append( "." );
+                }
+
             }
             if ( !stackTraceElement.getClassName().equals( testClassName ) )
             {
-                if ( i > 0 )
-                {
-                    result.append( "<" );
-                }
                 result.append( getSimpleName( stackTraceElement.getClassName() 
) ); // Add the name of the superclas
-                result.append( "#" );
+                result.append( "." );
             }
-            result.append( stackTraceElement.getMethodName() ).append( "(" 
).append(
-                stackTraceElement.getLineNumber() ).append( ")" );
-            result.append( "." );
+            result.append( stackTraceElement.getMethodName() ).append( ":" 
).append(
+                stackTraceElement.getLineNumber() );
+            result.append( "->" );
         }
 
         result.deleteCharAt( result.length() - 1 );
+        result.deleteCharAt( result.length() - 1 );
 
         if ( throwable.getTarget() instanceof AssertionError )
         {
@@ -112,13 +118,27 @@ public class SmartStackTraceParser
         }
         else
         {
-            result.append( rootIsInclass() ? " " : " >> " );
-            result.append( throwable.getTarget().getClass().getSimpleName() );
+            result.append( rootIsInclass() ? " " : " » " );
+            result.append( getMinimalThrowableMiniMessage( 
throwable.getTarget() ) );
             result.append( getTruncatedMessage( 77 - result.length() ) );
         }
         return result.toString();
     }
 
+    private String getMinimalThrowableMiniMessage( Throwable throwable )
+    {
+        String name = throwable.getClass().getSimpleName();
+        if ( name.endsWith( "Exception" ) )
+        {
+            return StringUtils.chompLast( name, "Exception" );
+        }
+        if ( name.endsWith( "Error" ) )
+        {
+            return StringUtils.chompLast( name, "Error" );
+        }
+        return name;
+    }
+
     private String getTruncatedMessage( int i )
     {
         if ( i < 0 )

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/93beca95/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/SmartStackTraceParserTest.java
----------------------------------------------------------------------
diff --git 
a/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/SmartStackTraceParserTest.java
 
b/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/SmartStackTraceParserTest.java
index 9affc79..b8c6c0e 100644
--- 
a/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/SmartStackTraceParserTest.java
+++ 
b/surefire-providers/common-java5/src/test/java/org/apache/maven/surefire/report/SmartStackTraceParserTest.java
@@ -38,9 +38,10 @@ public class SmartStackTraceParserTest
         {
             SmartStackTraceParser smartStackTraceParser = new 
SmartStackTraceParser( ATestClass.class, e );
             String res = smartStackTraceParser.getString();
-            Assert.assertTrue( "ATestClass#failInAssert(30) X is not 
Z".equals( res ) );
+            assertEquals( "ATestClass.failInAssert:30 X is not Z", res );
 
         }
+
     }
 
     public void testNestedFailure()
@@ -55,8 +56,7 @@ public class SmartStackTraceParserTest
         {
             SmartStackTraceParser smartStackTraceParser = new 
SmartStackTraceParser( ATestClass.class, e );
             String res = smartStackTraceParser.getString();
-            Assert.assertTrue( 
"ATestClass#nestedFailInAssert(35).failInAssert(30) X is not Z".equals( res ) );
-
+            assertEquals( "ATestClass.nestedFailInAssert:35->failInAssert:30 X 
is not Z", res );
         }
     }
 
@@ -73,7 +73,7 @@ public class SmartStackTraceParserTest
         {
             SmartStackTraceParser smartStackTraceParser = new 
SmartStackTraceParser( ATestClass.class, e );
             String res = smartStackTraceParser.getString();
-            Assert.assertTrue( "ATestClass#nestedNpe(45).npe(40) 
NullPointerException It was null".equals( res ) );
+            assertEquals( "ATestClass.nestedNpe:45->npe:40 NullPointer It was 
null", res );
 
         }
     }
@@ -91,8 +91,7 @@ public class SmartStackTraceParserTest
         {
             SmartStackTraceParser smartStackTraceParser = new 
SmartStackTraceParser( ATestClass.class, e );
             String res = smartStackTraceParser.getString();
-            Assert.assertTrue(
-                "ATestClass#nestedNpeOutsideTest(55).npeOutsideTest(50) >> 
NullPointerException".equals( res ) );
+            assertEquals( 
"ATestClass.nestedNpeOutsideTest:55->npeOutsideTest:50 » NullPointer", res );
 
         }
     }
@@ -109,8 +108,7 @@ public class SmartStackTraceParserTest
         {
             SmartStackTraceParser smartStackTraceParser = new 
SmartStackTraceParser( ATestClass.class, e );
             String res = smartStackTraceParser.getString();
-            Assert.assertTrue(
-                "ATestClass#aLongTestErrorMessage(60) RuntimeException This 
message will be tru...".equals( res ) );
+            assertEquals( "ATestClass.aLongTestErrorMessage:60 Runtime This 
message will be truncated, so...", res );
 
         }
     }
@@ -127,8 +125,7 @@ public class SmartStackTraceParserTest
         {
             SmartStackTraceParser smartStackTraceParser = new 
SmartStackTraceParser( ASubClass.class, e );
             String res = smartStackTraceParser.getString();
-            Assert.assertTrue( "ASubClass#ABaseClass#npe(27) >> 
NullPointerException It was null".equals( res ) );
-
+            assertEquals( "ASubClass>ABaseClass.npe:27 » NullPointer It was 
null", res );
         }
     }
 

Reply via email to