New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SUREFIRE-1992] - Do not abbreviate test error/failure messages to 78 characters #452
Conversation
if ( throwable.getTarget() instanceof AssertionError ) | ||
if ( throwable.getTarget() instanceof AssertionError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This if ( ... )
is a pure trojan horse.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section of code is suited for another Jira ticket.
The way we split the fix purpose we can better separate commits per issue in the git history.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unintentional. I'll amend the PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to open a new Jira and PR with acceptance of asserions exceptions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sman-81
I am not sure why the author of smartTrimmedStackTrace()
ignores other exceptions. Try to open a new PR and try to turn the IF statement to:
if ( throwable.getTarget() != null )
I want to know if the old code makes strong sense to the tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The exception message may have multiple lines. They may produce a huge report on the console. My advice is to print only the first line if exists.
@@ -81,10 +79,15 @@ public String smartTrimmedStackTrace() | |||
result.append( "#" ); | |||
result.append( testMethod ); | |||
SafeThrowable throwable = getThrowable(); | |||
final String excClassName = throwable.getTarget().getClass().getName(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may throw NPE.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hint: try to use Java 1.8 Optional
.
surefire-api/src/main/java/org/apache/maven/surefire/api/report/LegacyPojoStackTraceWriter.java
Outdated
Show resolved
Hide resolved
@@ -93,7 +96,7 @@ public String smartTrimmedStackTrace() | |||
{ | |||
result.append( " " ); | |||
result.append( target.getClass().getSimpleName() ); | |||
result.append( getTruncatedMessage( throwable.getMessage(), MAX_LINE_LENGTH - result.length() ) ); | |||
result.append( throwable.getMessage() ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again missing the null check.
@@ -149,7 +147,7 @@ public String getString() | |||
result.append( rootIsInclass() ? " " : " » " ) | |||
.append( toMinimalThrowableMiniMessage( excType ) ); | |||
|
|||
result.append( truncateMessage( msg, MAX_LINE_LENGTH - result.length() ) ); | |||
result.append( msg ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
null check
Thanks for your feedback! |
@sman-81 |
we should add instruction to readme ... |
that would be helpful @Tibor17 My latest commit limits error/failure messages to first line. Also added a new test. |
@sman-81 |
re: IDE SetupIn Eclipse, right-click on project -> Maven -> Select Maven Profiles ..., pick Despite this still 194 errors. Eclipse keeps building in an endless loop. CPU usage is high. A major source of errors is missing The POM relies on Anyways, any pointers how to set up in Eclipse are welcome. |
@sman-81 |
I will look into it. If we are lucky the successor is a drop-in replacement. Codehaus has beeen defunct for quite some time afaik. When will the automatic checks of this pull request continue? The status has been: |
Issue SUREFIRE-1994: Upgrade and configure javacc-maven-plugin created. |
What's holding up the CI? |
I'm new to this project. |
Thanks for triggering the re-run. Test |
@sman-81 |
@sman-81
Would you please fork this work in several PRs? Thx |
@slawekjaranowski |
Last build was hanging ... I rerun also ... I will not investigate why .. sometime some of build hang on GH. |
I don't know how to do this. |
@sman-81 |
Hi @Tibor17
I'm OK using command line. Good practice :)
This PR is now limited to point 1 above. Two new pull requests are |
@sman-81 |
@sman-81 |
my pleasure, it was fun |
Pull request for ticket [SUREFIRE-1992] which removes abbreviation of test error/failure messages to 78 characters in two classes that write test results to stdout/stderr.
The fix greatly improves usability of surefire when troubleshooting test failures.