[ https://issues.apache.org/jira/browse/SUREFIRE-1017?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16718036#comment-16718036 ]
ASF GitHub Bot commented on SUREFIRE-1017: ------------------------------------------ Tibor17 closed pull request #92: [SUREFIRE-1017] Failures do not show test-package since 2.13 URL: https://github.com/apache/maven-surefire/pull/92 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): 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 056eef343..13401433a 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 @@ -32,15 +32,12 @@ @SuppressWarnings( "ThrowableResultOfMethodCallIgnored" ) public class SmartStackTraceParser { - private static final int MAX_LINE_LENGTH = 77; private final SafeThrowable throwable; private final StackTraceElement[] stackTrace; - private final String simpleName; - private String testClassName; private final Class testClass; @@ -57,7 +54,6 @@ public SmartStackTraceParser( String testClassName, Throwable throwable, String this.testMethodName = testMethodName; this.testClassName = testClassName; this.testClass = getClass( testClassName ); - this.simpleName = this.testClassName.substring( this.testClassName.lastIndexOf( "." ) + 1 ); this.throwable = new SafeThrowable( throwable ); stackTrace = throwable.getStackTrace(); } @@ -94,7 +90,7 @@ public String getString() Collections.reverse( stackTraceElements ); if ( stackTraceElements.isEmpty() ) { - result.append( simpleName ); + result.append( testClassName ); if ( StringUtils.isNotEmpty( testMethodName ) ) { result.append( "." ).append( testMethodName ); @@ -102,13 +98,14 @@ public String getString() } else { - for ( int i = 0; i < stackTraceElements.size(); i++ ) + for ( int i = 0, size = stackTraceElements.size(); i < size; i++ ) { final StackTraceElement stackTraceElement = stackTraceElements.get( i ); + final boolean isTestClassName = stackTraceElement.getClassName().equals( testClassName ); if ( i == 0 ) { - result.append( simpleName ); - if ( !stackTraceElement.getClassName().equals( testClassName ) ) + result.append( testClassName ); + if ( !isTestClassName ) { result.append( ">" ); } @@ -117,14 +114,15 @@ public String getString() result.append( "." ); } } - if ( !stackTraceElement.getClassName().equals( testClassName ) ) + if ( !isTestClassName ) { - result.append( getSimpleName( stackTraceElement.getClassName() ) ); // Add the name of the superclas + result.append( getSimpleName( stackTraceElement.getClassName() ) ); // Add the name of superclass result.append( "." ); } - result.append( stackTraceElement.getMethodName() ).append( ":" ).append( - stackTraceElement.getLineNumber() ); - result.append( "->" ); + result.append( stackTraceElement.getMethodName() ) + .append( ":" ) + .append( stackTraceElement.getLineNumber() ) + .append( "->" ); } if ( result.length() >= 2 ) @@ -134,17 +132,17 @@ public String getString() } } - Throwable target = throwable.getTarget(); - if ( target instanceof AssertionError ) - { - result.append( " " ); - result.append( throwable.getMessage() ); - } - else if ( "junit.framework.AssertionFailedError".equals( target.getClass().getName() ) - || "junit.framework.ComparisonFailure".equals( target.getClass().getName() ) ) + final Throwable target = throwable.getTarget(); + if ( target instanceof AssertionError + || "junit.framework.AssertionFailedError".equals( target.getClass().getName() ) + || "junit.framework.ComparisonFailure".equals( target.getClass().getName() ) ) { - result.append( " " ); - result.append( throwable.getMessage() ); + String msg = throwable.getMessage(); + if ( StringUtils.isNotBlank( msg ) ) + { + result.append( " " ); + result.append( msg ); + } } else { ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Failures do not show test-package since 2.13 > -------------------------------------------- > > Key: SUREFIRE-1017 > URL: https://issues.apache.org/jira/browse/SUREFIRE-1017 > Project: Maven Surefire > Issue Type: Improvement > Affects Versions: 2.13, 2.14, 2.15 > Reporter: Christian Spriegel > Assignee: Tibor Digana > Priority: Major > > Older versions of surefire always showed the package name of each failed test > in the result overview. > Since surefire 2.13 I simply get the classname: > {code} > Results : > Failed tests: > RoundtripTest>AbstractTestNGSpringContextTests.run:196->test:115 error > RoundtripTest>AbstractTestNGSpringContextTests.run:196->test:115 error > {code} > As you can see I have two tests called RoundtripTest in the overview. These > testclasses are in different packages, but I do not know which one is which. > My testsuite has 830 testcases, where ~650 are called RoundtripTest. So its > quite hard now for me to identify the failing tests. > SUREFIRE-936 seems to have changed this. I have not checked the git commit, > but from the description I assume that was the change. -- This message was sent by Atlassian JIRA (v7.6.3#76005)