You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/10/29 12:57:05 UTC

[GitHub] [maven-surefire] MrFix93 opened a new pull request, #574: [SUREFIRE-1887] Trim stacktraces to include relevant lines

MrFix93 opened a new pull request, #574:
URL: https://github.com/apache/maven-surefire/pull/574

   Following issue [SUREFIRE-1887](https://issues.apache.org/jira/browse/SUREFIRE-1887), this PR features an improved version of [`trimStackTrace`](https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#trimStackTrace).
   
   With this implementation a trimmed stacktrace not only consist of the element(s) in the test class, but extends the stacktrace to include methods calls leading up to the test method.
   
   Before (with `trimStackTrace` = true): 
   ![image](https://user-images.githubusercontent.com/15997846/198831576-80d2a301-095a-4954-a955-c2b816a5a51a.png)
   
   After (with `trimStackTrace` = true): 
   ![image](https://user-images.githubusercontent.com/15997846/198831581-b43b89a4-508f-4ccf-ba0d-a9e70845fd21.png)
   
   After releasing and collecting feedback, we propose to make `trimStackTrace` to be enabled by default. This would greatly reduce the stacktraces and thereby the footprint of build output. 
   
   Following this checklist to help us incorporate your 
   contribution quickly and easily:
   
    - [x] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/SUREFIRE) filed 
          for the change (usually before you start working on it).  Trivial changes like typos do not 
          require a JIRA issue.  Your pull request should address just this issue, without 
          pulling in other changes.
    - [x] Each commit in the pull request should have a meaningful subject line and body.
    - [x] Format the pull request title like `[SUREFIRE-XXX] - Fixes bug in ApproximateQuantiles`,
          where you replace `SUREFIRE-XXX` with the appropriate JIRA issue. Best practice
          is to use the JIRA issue title in the pull request title and in the first line of the 
          commit message.
    - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
    - [x] Run `mvn clean install` to make sure basic checks pass. A more thorough check will 
          be performed on your pull request automatically.
    - [x] You have run the integration tests successfully (`mvn -Prun-its clean install`).
   
   If your pull request is about ~20 lines of code you don't need to sign an
   [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure
   please ask on the developers list.
   
   To make clear that you license your contribution under 
   the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   you have to acknowledge this by using the following check-box.
   
    - [x] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   
    - [ ] In any other case, please file an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-surefire] elharo commented on pull request #574: [SUREFIRE-1887] Trim stacktraces to include relevant lines

Posted by GitBox <gi...@apache.org>.
elharo commented on PR #574:
URL: https://github.com/apache/maven-surefire/pull/574#issuecomment-1344272774

   
   I don't think this is right. Per docs, trimStackTrace controls "Whether to trim the stack trace in the reports to just the lines within the test, or show the full trace." This PR changes that behavior. 
   
   At a minimum the docs need to be updated in the same PR. However SUREFIRE-1887 is about something different, removing the lines from the framework code, not the user's own code. I'm not sure we can change the existing option to make that possible. It might need a new option instead. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-surefire] elharo commented on a diff in pull request #574: [SUREFIRE-1887] Trim stacktraces to include relevant lines

Posted by GitBox <gi...@apache.org>.
elharo commented on code in PR #574:
URL: https://github.com/apache/maven-surefire/pull/574#discussion_r1044420785


##########
surefire-api/src/test/java/org/apache/maven/surefire/api/report/LegacyPojoStackTraceWriterTest.java:
##########
@@ -64,14 +65,18 @@ public void testWriteTrimmedTraceToString()
         MockThrowable t = new MockThrowable( stackTrace );
         LegacyPojoStackTraceWriter w = new LegacyPojoStackTraceWriter( "TestSurefire3", "testQuote", t );
         String out = w.writeTrimmedTraceToString();
-        String expected = "junit.framework.AssertionFailedError: blah\n" + "    at junit.framework.Assert.fail(Assert.java:47)\n" + "    at TestSurefire3.testQuote(TestSurefire3.java:23)\n";
+        String expected = "junit.framework.AssertionFailedError: blah\n"

Review Comment:
   I'm confused. This seems to add an extra line to the output and not remove anything. Is there a test that shows these changes making stack traces simpler?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org