[SUREFIRE-1084] Surefire-report stack traces appear on a single line.
Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/989479ea Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/989479ea Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/989479ea Branch: refs/heads/master Commit: 989479ea8451d11bdbe3e252892466574bcdf467 Parents: dcb4730 Author: Tibor17 <tibo...@lycos.com> Authored: Mon Jun 29 00:24:39 2015 +0200 Committer: Tibor17 <tibo...@lycos.com> Committed: Mon Jun 29 00:24:39 2015 +0200 ---------------------------------------------------------------------- .../report/SurefireReportGenerator.java | 138 ++--- .../surefire/report/Surefire597Test.java | 96 ++++ .../surefire/report/SurefireReportMojoTest.java | 348 ++++++++++++- .../surefire-597/TEST-surefire.MyTest.xml | 44 ++ .../plugin-config.xml | 38 ++ ...-surefire.MyTest-enclosed-trimStackTrace.xml | 18 + .../surefire-report-enclosed/plugin-config.xml | 38 ++ .../TEST-surefire.MyTest-enclosed.xml | 52 ++ .../plugin-config.xml | 38 ++ ...refire.MyTest-nestedClass-trimStackTrace.xml | 19 + .../plugin-config.xml | 38 ++ .../TEST-surefire.MyTest-nestedClass.xml | 43 ++ .../plugin-config.xml | 38 ++ .../surefire-reports/TEST-surefire.MyTest.xml | 43 ++ pom.xml | 2 +- surefire-integration-tests/pom.xml | 6 - .../Surefire224WellFormedXmlFailuresIT.java | 8 +- .../report/SmartStackTraceParserTest.java | 4 +- surefire-report-parser/pom.xml | 4 +- .../plugins/surefire/report/ReportTestCase.java | 95 +++- .../surefire/report/ReportTestSuite.java | 79 ++- .../surefire/report/SurefireReportParser.java | 80 +-- .../surefire/report/TestSuiteXmlParser.java | 283 ++++++----- .../surefire/report/ReportTestCaseTest.java | 17 +- .../surefire/report/ReportTestSuiteTest.java | 14 +- .../report/SurefireReportParserTest.java | 112 ++--- .../surefire/report/TestSuiteXmlParserTest.java | 504 ++++++++++++++++++- ...-surefire.MyTest-enclosed-trimStackTrace.xml | 18 + .../TEST-surefire.MyTest-enclosed.xml | 52 ++ ...refire.MyTest-nestedClass-trimStackTrace.xml | 19 + .../TEST-surefire.MyTest-nestedClass.xml | 43 ++ .../testsuitexmlparser/TEST-surefire.MyTest.xml | 43 ++ .../TEST-umlautTest.BasicTest.xml" | 7 + 33 files changed, 1904 insertions(+), 477 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/989479ea/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportGenerator.java ---------------------------------------------------------------------- diff --git a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportGenerator.java b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportGenerator.java index 0fbed99..a6e49cd 100644 --- a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportGenerator.java +++ b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportGenerator.java @@ -25,7 +25,6 @@ import java.util.List; import java.util.Locale; import java.util.Map; import java.util.ResourceBundle; -import java.util.StringTokenizer; import org.apache.maven.doxia.markup.HtmlMarkup; import org.apache.maven.doxia.sink.Sink; import org.apache.maven.doxia.sink.SinkEventAttributeSet; @@ -36,8 +35,12 @@ import org.apache.maven.reporting.MavenReportException; /** * */ -public class SurefireReportGenerator +public final class SurefireReportGenerator { + private static final Object[] TAG_TYPE_START = new Object[]{ HtmlMarkup.TAG_TYPE_START }; + + private static final Object[] TAG_TYPE_END = new Object[]{ HtmlMarkup.TAG_TYPE_END }; + private final SurefireReportParser report; private List<ReportTestSuite> testSuites; @@ -363,9 +366,8 @@ public class SurefireReportGenerator sinkCell( sink, Integer.toString( suite.getNumberOfSkipped() ) ); - String percentage = - report.computePercentage( suite.getNumberOfTests(), suite.getNumberOfErrors(), - suite.getNumberOfFailures(), suite.getNumberOfSkipped() ); + String percentage = report.computePercentage( suite.getNumberOfTests(), suite.getNumberOfErrors(), + suite.getNumberOfFailures(), suite.getNumberOfSkipped() ); sinkCell( sink, percentage + "%" ); sinkCell( sink, numberFormat.format( suite.getTimeElapsed() ) ); @@ -403,7 +405,7 @@ public class SurefireReportGenerator for ( ReportTestCase testCase : testCases ) { - if ( testCase.getFailure() != null || showSuccess ) + if ( testCase.hasFailure() || showSuccess ) { showTable = true; @@ -419,7 +421,7 @@ public class SurefireReportGenerator for ( ReportTestCase testCase : testCases ) { - if ( testCase.getFailure() != null || showSuccess ) + if ( testCase.hasFailure() || showSuccess ) { constructTestCaseSection( sink, numberFormat, testCase ); } @@ -445,13 +447,11 @@ public class SurefireReportGenerator sink.tableCell(); - Map<String, Object> failure = testCase.getFailure(); - - if ( failure != null ) + if ( testCase.getFailureType() != null ) { sink.link( "#" + toHtmlId( testCase.getFullName() ) ); - sinkIcon( (String) failure.get( "type" ), sink ); + sinkIcon( testCase.getFailureType(), sink ); sink.link_(); } @@ -462,7 +462,7 @@ public class SurefireReportGenerator sink.tableCell_(); - if ( failure != null ) + if ( testCase.hasFailure() ) { sink.tableCell(); @@ -473,28 +473,28 @@ public class SurefireReportGenerator SinkEventAttributeSet atts = new SinkEventAttributeSet(); atts.addAttribute( SinkEventAttributes.CLASS, "detailToggle" ); atts.addAttribute( SinkEventAttributes.STYLE, "display:inline" ); - sink.unknown( "div", new Object[]{ HtmlMarkup.TAG_TYPE_START }, atts ); + sink.unknown( "div", TAG_TYPE_START, atts ); sink.link( "javascript:toggleDisplay('" + toHtmlId( testCase.getFullName() ) + "');" ); atts = new SinkEventAttributeSet(); atts.addAttribute( SinkEventAttributes.STYLE, "display:inline;" ); atts.addAttribute( SinkEventAttributes.ID, toHtmlId( testCase.getFullName() ) + "off" ); - sink.unknown( "span", new Object[]{ HtmlMarkup.TAG_TYPE_START }, atts ); + sink.unknown( "span", TAG_TYPE_START, atts ); sink.text( " + " ); - sink.unknown( "span", new Object[]{ HtmlMarkup.TAG_TYPE_END }, null ); + sink.unknown( "span", TAG_TYPE_END, null ); atts = new SinkEventAttributeSet(); atts.addAttribute( SinkEventAttributes.STYLE, "display:none;" ); atts.addAttribute( SinkEventAttributes.ID, toHtmlId( testCase.getFullName() ) + "on" ); - sink.unknown( "span", new Object[]{ HtmlMarkup.TAG_TYPE_START }, atts ); + sink.unknown( "span", TAG_TYPE_START, atts ); sink.text( " - " ); - sink.unknown( "span", new Object[]{ HtmlMarkup.TAG_TYPE_END }, null ); + sink.unknown( "span", TAG_TYPE_END, null ); sink.text( "[ Detail ]" ); sink.link_(); - sink.unknown( "div", new Object[]{ HtmlMarkup.TAG_TYPE_END }, null ); + sink.unknown( "div", TAG_TYPE_END, null ); sink.tableCell_(); } @@ -507,19 +507,18 @@ public class SurefireReportGenerator sink.tableRow_(); - if ( failure != null ) + if ( testCase.hasFailure() ) { sink.tableRow(); sinkCell( sink, "" ); - sinkCell( sink, (String) failure.get( "message" ) ); + sinkCell( sink, testCase.getFailureMessage() ); sinkCell( sink, "" ); sink.tableRow_(); - @SuppressWarnings( "unchecked" ) List<String> detail = (List<String>) failure.get( "detail" ); + String detail = testCase.getFailureDetail(); if ( detail != null ) { - sink.tableRow(); sinkCell( sink, "" ); @@ -527,17 +526,13 @@ public class SurefireReportGenerator SinkEventAttributeSet atts = new SinkEventAttributeSet(); atts.addAttribute( SinkEventAttributes.ID, toHtmlId( testCase.getFullName() ) + "error" ); atts.addAttribute( SinkEventAttributes.STYLE, "display:none;" ); - sink.unknown( "div", new Object[]{ HtmlMarkup.TAG_TYPE_START }, atts ); + sink.unknown( "div", TAG_TYPE_START, atts ); sink.verbatim( null ); - for ( String line : detail ) - { - sink.text( line + "\n" ); - sink.lineBreak(); - } + sink.text( detail ); sink.verbatim_(); - sink.unknown( "div", new Object[]{ HtmlMarkup.TAG_TYPE_END }, null ); + sink.unknown( "div", TAG_TYPE_END, null ); sink.tableCell_(); sinkCell( sink, "" ); @@ -547,17 +542,9 @@ public class SurefireReportGenerator } } - private String toHtmlId( String id ) { - if ( DoxiaUtils.isValidId( id ) ) - { - return id; - } - else - { - return DoxiaUtils.encodeId( id, true ); - } + return DoxiaUtils.isValidId( id ) ? id : DoxiaUtils.encodeId( id, true ); } private void constructFailureDetails( Sink sink, ResourceBundle bundle, List<ReportTestCase> failures ) @@ -579,13 +566,12 @@ public class SurefireReportGenerator for ( ReportTestCase tCase : failures ) { - Map<String, Object> failure = tCase.getFailure(); - sink.tableRow(); sink.tableCell(); - String type = (String) failure.get( "type" ); + String type = tCase.getFailureType(); + sinkIcon( type, sink ); sink.tableCell_(); @@ -594,44 +580,19 @@ public class SurefireReportGenerator sink.tableRow_(); - String message = (String) failure.get( "message" ); + String message = tCase.getFailureMessage(); sink.tableRow(); sinkCell( sink, "" ); - StringBuilder sb = new StringBuilder(); - sb.append( type ); - - if ( message != null ) - { - sb.append( ": " ); - sb.append( message ); - } - - sinkCell( sink, sb.toString() ); + sinkCell( sink, message == null ? type : type + ": " + message ); sink.tableRow_(); - @SuppressWarnings( "unchecked" ) List<String> detail = (List<String>) failure.get( "detail" ); + String detail = tCase.getFailureDetail(); if ( detail != null ) { - boolean firstLine = true; - - String techMessage = ""; - for ( String line : detail ) - { - techMessage = line; - if ( firstLine ) - { - firstLine = false; - } - else - { - sink.text( " " ); - } - } - sink.tableRow(); sinkCell( sink, "" ); @@ -639,23 +600,22 @@ public class SurefireReportGenerator sink.tableCell(); SinkEventAttributeSet atts = new SinkEventAttributeSet(); atts.addAttribute( SinkEventAttributes.ID, tCase.getName() + "error" ); - sink.unknown( "div", new Object[]{ HtmlMarkup.TAG_TYPE_START }, atts ); + sink.unknown( "div", TAG_TYPE_START, atts ); + String fullClassName = tCase.getFullClassName(); + String errorLineNumber = tCase.getFailureErrorLine(); if ( xrefLocation != null ) { - String path = tCase.getFullClassName().replace( '.', '/' ); - - sink.link( xrefLocation + "/" + path + ".html#" - + getErrorLineNumber( tCase.getFullName(), techMessage ) ); + String path = fullClassName.replace( '.', '/' ); + sink.link( xrefLocation + "/" + path + ".html#" + errorLineNumber ); } - sink.text( - tCase.getFullClassName() + ":" + getErrorLineNumber( tCase.getFullName(), techMessage ) ); + sink.text( fullClassName + ":" + errorLineNumber ); if ( xrefLocation != null ) { sink.link_(); } - sink.unknown( "div", new Object[]{ HtmlMarkup.TAG_TYPE_END }, null ); + sink.unknown( "div", TAG_TYPE_END, null ); sink.tableCell_(); @@ -672,30 +632,6 @@ public class SurefireReportGenerator sink.section1_(); } - private String getErrorLineNumber( String className, String source ) - { - StringTokenizer tokenizer = new StringTokenizer( source ); - - while ( tokenizer.hasMoreTokens() ) - { - String token = tokenizer.nextToken(); - if ( token.startsWith( className ) ) - { - int idx = token.indexOf( ":" ); - if ( idx >= 0 ) - { - int closeIdx = token.lastIndexOf( ")" ); - - if ( closeIdx > idx + 1 ) - { - return token.substring( idx + 1, closeIdx ); - } - } - } - } - return ""; - } - private void constructHotLinks( Sink sink, ResourceBundle bundle ) { if ( !testSuites.isEmpty() ) http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/989479ea/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/Surefire597Test.java ---------------------------------------------------------------------- diff --git a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/Surefire597Test.java b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/Surefire597Test.java new file mode 100644 index 0000000..079b667 --- /dev/null +++ b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/Surefire597Test.java @@ -0,0 +1,96 @@ +package org.apache.maven.plugins.surefire.report; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.doxia.module.xhtml.XhtmlSink; +import org.junit.Test; + +import java.io.File; +import java.io.StringWriter; +import java.util.ResourceBundle; + +import static java.util.Collections.singletonList; +import static java.util.Locale.ENGLISH; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.containsString; + +/** + * Prevent fom NPE if failure type and message is null however detail presents. + */ +public class Surefire597Test +{ + @Test + public void corruptedTestCaseFailureWithMissingErrorTypeAndMessage() + throws Exception + { + File basedir = new File( "." ).getCanonicalFile(); + File report = new File( basedir, "target/test-classes/surefire-597" ); + SurefireReportGenerator gen = new SurefireReportGenerator( singletonList( report ), ENGLISH, true, null ); + ResourceBundle resourceBundle = ResourceBundle.getBundle( "surefire-report", ENGLISH ); + StringWriter writer = new StringWriter(); + gen.doGenerateReport( resourceBundle, new XhtmlSink( writer ) {} ); + String xml = writer.toString(); + assertThat( xml, containsString( + "<table border=\"1\" class=\"bodyTable\">" + + "<tr class=\"a\">" + + "<th>Tests</th><th>Errors </th><th>Failures</th><th>Skipped</th><th>Success Rate</th><th>Time</th>" + + "</tr>" + + "<tr class=\"b\">" + + "<td>1</td><td>1</td><td>0</td><td>0</td><td>0%</td><td>0</td>" + + "</tr>" + + "</table>" ) ); + assertThat( xml, containsString( + "<table border=\"1\" class=\"bodyTable\">" + + "<tr class=\"a\">" + + "<th>Package</th><th>Tests</th><th>Errors </th><th>Failures</th><th>Skipped</th>" + + "<th>Success Rate</th><th>Time</th>" + + "</tr>" + + "<tr class=\"b\">" + + "<td><a href=\"#surefire\">surefire</a></td><td>1</td><td>1</td><td>0</td><td>0</td>" + + "<td>0%</td><td>0</td>" + + "</tr>" + + "</table>" ) ); + assertThat( xml, containsString( + "<table border=\"1\" class=\"bodyTable\">" + + "<tr class=\"a\">" + + "<th></th><th>Class</th><th>Tests</th><th>Errors </th><th>Failures</th><th>Skipped</th>" + + "<th>Success Rate</th><th>Time</th>" + + "</tr>" + + "<tr class=\"b\">" + + "<td><a href=\"#surefireMyTest\"><img src=\"images/icon_error_sml.gif\" alt=\"\" /></a></td>" + + "<td><a href=\"#surefireMyTest\">MyTest</a></td>" + + "<td>1</td><td>1</td><td>0</td><td>0</td><td>0%</td><td>0</td>" + + "</tr>" + + "</table>" ) ); + assertThat( xml, containsString( + "<table border=\"1\" class=\"bodyTable\">" + + "<tr class=\"a\">" + + "<td><img src=\"images/icon_error_sml.gif\" alt=\"\" /></td>" + + "<td><a name=\"surefire.MyTest.test\"></a>test</td></tr>" + + "<tr class=\"b\">" + + "<td></td><td>java.lang.RuntimeException: java.lang.IndexOutOfBoundsException: msg</td>" + + "</tr>" + + "<tr class=\"a\">" + + "<td></td><td><div id=\"testerror\">surefire.MyTest:13</div></td>" + + "</tr>" + + "</table>" ) ); + + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/989479ea/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportMojoTest.java ---------------------------------------------------------------------- diff --git a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportMojoTest.java b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportMojoTest.java index 832278e..e389bd1 100644 --- a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportMojoTest.java +++ b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportMojoTest.java @@ -37,6 +37,9 @@ import org.apache.maven.shared.utils.WriterFactory; import org.apache.maven.shared.utils.io.FileUtils; import org.apache.maven.shared.utils.io.IOUtil; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.containsString; + /** * @author <a href="mailto:arami...@apache.org">Allan Ramirez</a> */ @@ -64,7 +67,7 @@ public class SurefireReportMojoTest File outputDir = (File) getVariableValueFromObject( mojo, "outputDirectory" ); - boolean showSuccess = ( (Boolean) getVariableValueFromObject( mojo, "showSuccess" ) ).booleanValue(); + boolean showSuccess = (Boolean) getVariableValueFromObject( mojo, "showSuccess" ); File reportsDir = (File) getVariableValueFromObject( mojo, "reportsDirectory" ); @@ -72,7 +75,7 @@ public class SurefireReportMojoTest File xrefLocation = (File) getVariableValueFromObject( mojo, "xrefLocation" ); - boolean linkXRef = ( (Boolean) getVariableValueFromObject( mojo, "linkXRef" ) ).booleanValue(); + boolean linkXRef = (Boolean) getVariableValueFromObject( mojo, "linkXRef" ); assertEquals( new File( getBasedir() + "/target/site/unit/basic-surefire-report-test" ), outputDir ); @@ -121,7 +124,7 @@ public class SurefireReportMojoTest assertNotNull( mojo ); - boolean showSuccess = ( (Boolean) getVariableValueFromObject( mojo, "showSuccess" ) ).booleanValue(); + boolean showSuccess = (Boolean) getVariableValueFromObject( mojo, "showSuccess" ); assertFalse( showSuccess ); @@ -150,7 +153,7 @@ public class SurefireReportMojoTest assertNotNull( mojo ); - boolean linkXRef = ( (Boolean) getVariableValueFromObject( mojo, "linkXRef" ) ).booleanValue(); + boolean linkXRef = (Boolean) getVariableValueFromObject( mojo, "linkXRef" ); assertFalse( linkXRef ); @@ -206,8 +209,8 @@ public class SurefireReportMojoTest mojo.execute(); - File report = - new File( getBasedir(), "target/site/unit/basic-surefire-report-anchor-test-cases/surefire-report.html" ); + File report = new File( getBasedir(), + "target/site/unit/basic-surefire-report-anchor-test-cases/surefire-report.html" ); renderer( mojo, report ); @@ -218,10 +221,341 @@ public class SurefireReportMojoTest int idx = htmlContent.indexOf( "<td><a name=\"TC_com.shape.CircleTest.testX\"></a>testX</td>" ); assertTrue( idx > 0 ); - idx = htmlContent.indexOf( "<td><a name=\"TC_com.shape.CircleTest.testRadius\"></a><a href=\"#com.shape.CircleTest.testRadius\">testRadius</a>" ); + idx = htmlContent.indexOf( "<td><a name=\"TC_com.shape.CircleTest.testRadius\"></a>" + + "<a href=\"#com.shape.CircleTest.testRadius\">testRadius</a>" ); assertTrue( idx > 0 ); } + public void testSurefireReportSingleError() + throws Exception + { + File testPom = new File( getUnitBaseDir(), "surefire-report-single-error/plugin-config.xml" ); + SurefireReportMojo mojo = (SurefireReportMojo) lookupMojo( "report", testPom ); + assertNotNull( mojo ); + mojo.execute(); + File report = new File( getBasedir(), "target/site/unit/surefire-report-single-error/surefire-report.html" ); + renderer( mojo, report ); + assertTrue( report.exists() ); + String htmlContent = FileUtils.fileRead( report ); + + assertThat( htmlContent, + containsString( "<tr class=\"b\">" + + "<td>1</td><td>1</td><td>0</td><td>0</td><td>0%</td><td>0</td>" ) ); + + assertThat( htmlContent, + containsString( "<tr class=\"b\">" + + "<td><a href=\"#surefire\">surefire</a></td>" + + "<td>1</td><td>1</td><td>0</td><td>0</td><td>0%</td><td>0</td>" + + "</tr>" ) ); + assertThat( htmlContent, + containsString( "<tr class=\"b\">" + + "<td>" + + "<a href=\"#surefireMyTest\">" + + "<img src=\"images/icon_error_sml.gif\" alt=\"\" />" + + "</a>" + + "</td>" + + "<td><a href=\"#surefireMyTest\">MyTest</a></td>" + + "<td>1</td><td>1</td><td>0</td><td>0</td><td>0%</td><td>0</td>" + + "</tr>" ) ); + assertThat( htmlContent, + containsString( ">surefire.MyTest:13</a>" ) ); + + assertThat( htmlContent, containsString( "./xref-test/surefire/MyTest.html#13" ) ); + + assertThat( htmlContent, containsString( "<pre>" + + "java.lang.RuntimeException: java.lang.IndexOutOfBoundsException\r\n" + + "\tat surefire.MyTest.rethrownDelegate(MyTest.java:24)\r\n" + + "\tat surefire.MyTest.newRethrownDelegate(MyTest.java:17)\r\n" + + "\tat surefire.MyTest.test(MyTest.java:13)\r\n" + + "\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n" + + "\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)\r\n" + + "\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n" + + "\tat java.lang.reflect.Method.invoke(Method.java:606)\r\n" + + "\tat org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)\r\n" + + "\tat org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)\r\n" + + "\tat org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)\r\n" + + "\tat org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)\r\n" + + "\tat org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)\r\n" + + "\tat org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)\r\n" + + "\tat org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)\r\n" + + "\tat org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)\r\n" + + "\tat org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)\r\n" + + "\tat org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)\r\n" + + "\tat org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)\r\n" + + "\tat org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)\r\n" + + "\tat org.junit.runners.ParentRunner.run(ParentRunner.java:363)\r\n" + + "\tat org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:272)\r\n" + + "\tat org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:167)\r\n" + + "\tat org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:147)\r\n" + + "\tat org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:130)\r\n" + + "\tat org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:211)\r\n" + + "\tat org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:163)\r\n" + + "\tat org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:105)\r\n" + + "\tCaused by: java.lang.IndexOutOfBoundsException\r\n" + + "\tat surefire.MyTest.failure(MyTest.java:33)\r\n" + + "\tat surefire.MyTest.access$100(MyTest.java:9)\r\n" + + "\tat surefire.MyTest$Nested.run(MyTest.java:38)\r\n" + + "\tat surefire.MyTest.delegate(MyTest.java:29)\r\n" + + "\tat surefire.MyTest.rethrownDelegate(MyTest.java:22)" + + "</pre>" ) ); + } + + public void testSurefireReportNestedClassTrimStackTrace() + throws Exception + { + File testPom = new File( getUnitBaseDir(), "surefire-report-nestedClass-trimStackTrace/plugin-config.xml" ); + SurefireReportMojo mojo = (SurefireReportMojo) lookupMojo( "report", testPom ); + assertNotNull( mojo ); + mojo.execute(); + File report = new File( getBasedir(), "target/site/unit/surefire-report-nestedClass-trimStackTrace/surefire-report.html" ); + renderer( mojo, report ); + assertTrue( report.exists() ); + String htmlContent = FileUtils.fileRead( report ); + + assertThat( htmlContent, + containsString( "<tr class=\"b\">" + + "<td>1</td><td>1</td><td>0</td><td>0</td><td>0%</td><td>0</td>" ) ); + + assertThat( htmlContent, + containsString( "<tr class=\"b\">" + + "<td><a href=\"#surefire\">surefire</a></td>" + + "<td>1</td><td>1</td><td>0</td><td>0</td><td>0%</td><td>0</td>" + + "</tr>" ) ); + assertThat( htmlContent, + containsString( "<tr class=\"b\">" + + "<td>" + + "<a href=\"#surefireMyTest\">" + + "<img src=\"images/icon_error_sml.gif\" alt=\"\" />" + + "</a>" + + "</td>" + + "<td><a href=\"#surefireMyTest\">MyTest</a></td>" + + "<td>1</td><td>1</td><td>0</td><td>0</td><td>0%</td><td>0</td>" + + "</tr>" ) ); + assertThat( htmlContent, + containsString( ">surefire.MyTest:13</a>" ) ); + + assertThat( htmlContent, containsString( "./xref-test/surefire/MyTest.html#13" ) ); + + assertThat( htmlContent, containsString( "<pre>" + + "java.lang.RuntimeException: java.lang.IndexOutOfBoundsException\r\n" + + "\tat surefire.MyTest.rethrownDelegate(MyTest.java:24)\r\n" + + "\tat surefire.MyTest.newRethrownDelegate(MyTest.java:17)\r\n" + + "\tat surefire.MyTest.test(MyTest.java:13)\r\n" + + "\tCaused by: java.lang.IndexOutOfBoundsException\r\n" + + "\tat surefire.MyTest.failure(MyTest.java:33)\r\n" + + "\tat surefire.MyTest.access$100(MyTest.java:9)\r\n" + + "\tat surefire.MyTest$Nested.run(MyTest.java:38)\r\n" + + "\tat surefire.MyTest.delegate(MyTest.java:29)\r\n" + + "\tat surefire.MyTest.rethrownDelegate(MyTest.java:22)" + + "</pre>" ) ); + } + + public void testSurefireReportNestedClass() + throws Exception + { + File testPom = new File( getUnitBaseDir(), "surefire-report-nestedClass/plugin-config.xml" ); + SurefireReportMojo mojo = (SurefireReportMojo) lookupMojo( "report", testPom ); + assertNotNull( mojo ); + mojo.execute(); + File report = new File( getBasedir(), "target/site/unit/surefire-report-nestedClass/surefire-report.html" ); + renderer( mojo, report ); + assertTrue( report.exists() ); + String htmlContent = FileUtils.fileRead( report ); + + assertThat( htmlContent, + containsString( "<tr class=\"b\">" + + "<td>1</td><td>1</td><td>0</td><td>0</td><td>0%</td><td>0</td>" ) ); + + assertThat( htmlContent, + containsString( "<tr class=\"b\">" + + "<td><a href=\"#surefire\">surefire</a></td>" + + "<td>1</td><td>1</td><td>0</td><td>0</td><td>0%</td><td>0</td>" + + "</tr>" ) ); + assertThat( htmlContent, + containsString( "<tr class=\"b\">" + + "<td>" + + "<a href=\"#surefireMyTest\">" + + "<img src=\"images/icon_error_sml.gif\" alt=\"\" />" + + "</a>" + + "</td>" + + "<td><a href=\"#surefireMyTest\">MyTest</a></td>" + + "<td>1</td><td>1</td><td>0</td><td>0</td><td>0%</td><td>0</td>" + + "</tr>" ) ); + assertThat( htmlContent, + containsString( ">surefire.MyTest:13</a>" ) ); + + assertThat( htmlContent, containsString( "./xref-test/surefire/MyTest.html#13" ) ); + + assertThat( htmlContent, containsString( "<pre>" + + "java.lang.RuntimeException: java.lang.IndexOutOfBoundsException\r\n" + + "\tat surefire.MyTest.rethrownDelegate(MyTest.java:24)\r\n" + + "\tat surefire.MyTest.newRethrownDelegate(MyTest.java:17)\r\n" + + "\tat surefire.MyTest.test(MyTest.java:13)\r\n" + + "\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n" + + "\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)\r\n" + + "\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n" + + "\tat java.lang.reflect.Method.invoke(Method.java:606)\r\n" + + "\tat org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)\r\n" + + "\tat org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)\r\n" + + "\tat org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)\r\n" + + "\tat org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)\r\n" + + "\tat org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)\r\n" + + "\tat org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)\r\n" + + "\tat org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)\r\n" + + "\tat org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)\r\n" + + "\tat org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)\r\n" + + "\tat org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)\r\n" + + "\tat org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)\r\n" + + "\tat org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)\r\n" + + "\tat org.junit.runners.ParentRunner.run(ParentRunner.java:363)\r\n" + + "\tat org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:272)\r\n" + + "\tat org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:167)\r\n" + + "\tat org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:147)\r\n" + + "\tat org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:130)\r\n" + + "\tat org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:211)\r\n" + + "\tat org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:163)\r\n" + + "\tat org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:105)\r\n" + + "\tCaused by: java.lang.IndexOutOfBoundsException\r\n" + + "\tat surefire.MyTest.failure(MyTest.java:33)\r\n" + + "\tat surefire.MyTest.access$100(MyTest.java:9)\r\n" + + "\tat surefire.MyTest$Nested.run(MyTest.java:38)\r\n" + + "\tat surefire.MyTest.delegate(MyTest.java:29)\r\n" + + "\tat surefire.MyTest.rethrownDelegate(MyTest.java:22)" + + "</pre>" ) ); + } + + public void testSurefireReportEnclosedTrimStackTrace() + throws Exception + { + File testPom = new File( getUnitBaseDir(), "surefire-report-enclosed-trimStackTrace/plugin-config.xml" ); + SurefireReportMojo mojo = (SurefireReportMojo) lookupMojo( "report", testPom ); + assertNotNull( mojo ); + mojo.execute(); + File report = new File( getBasedir(), "target/site/unit/surefire-report-enclosed-trimStackTrace/surefire-report.html" ); + renderer( mojo, report ); + assertTrue( report.exists() ); + String htmlContent = FileUtils.fileRead( report ); + + assertThat( htmlContent, + containsString( "<tr class=\"b\">" + + "<td>1</td><td>1</td><td>0</td><td>0</td><td>0%</td><td>0</td>" ) ); + + assertThat( htmlContent, + containsString( "<tr class=\"b\">" + + "<td><a href=\"#surefire\">surefire</a></td>" + + "<td>1</td><td>1</td><td>0</td><td>0</td><td>0%</td><td>0</td>" + + "</tr>" ) ); + assertThat( htmlContent, + containsString( "<tr class=\"b\">" + + "<td>" + + "<a href=\"#surefireMyTest$A\">" + + "<img src=\"images/icon_error_sml.gif\" alt=\"\" />" + + "</a>" + + "</td>" + + "<td><a href=\"#surefireMyTest$A\">MyTest$A</a></td>" + + "<td>1</td><td>1</td><td>0</td><td>0</td><td>0%</td><td>0</td>" + + "</tr>" ) ); + assertThat( htmlContent, + containsString( ">surefire.MyTest$A:45</a>" ) ); + + assertThat( htmlContent, containsString( "./xref-test/surefire/MyTest$A.html#45" ) ); + + assertThat( htmlContent, containsString( "<pre>" + + "java.lang.RuntimeException: java.lang.IndexOutOfBoundsException\r\n" + + "\tat surefire.MyTest.failure(MyTest.java:33)\r\n" + + "\tat surefire.MyTest.access$100(MyTest.java:9)\r\n" + + "\tat surefire.MyTest$Nested.run(MyTest.java:38)\r\n" + + "\tat surefire.MyTest.delegate(MyTest.java:29)\r\n" + + "\tat surefire.MyTest.rethrownDelegate(MyTest.java:22)\r\n" + + "\tat surefire.MyTest.newRethrownDelegate(MyTest.java:17)\r\n" + + "\tat surefire.MyTest.access$200(MyTest.java:9)\r\n" + + "\tat surefire.MyTest$A.t(MyTest.java:45)" + + "</pre>" ) ); + } + + public void testSurefireReportEnclosed() + throws Exception + { + File testPom = new File( getUnitBaseDir(), "surefire-report-enclosed/plugin-config.xml" ); + SurefireReportMojo mojo = (SurefireReportMojo) lookupMojo( "report", testPom ); + assertNotNull( mojo ); + mojo.execute(); + File report = new File( getBasedir(), "target/site/unit/surefire-report-enclosed/surefire-report.html" ); + renderer( mojo, report ); + assertTrue( report.exists() ); + String htmlContent = FileUtils.fileRead( report ); + + assertThat( htmlContent, + containsString( "<tr class=\"b\">" + + "<td>1</td><td>1</td><td>0</td><td>0</td><td>0%</td><td>0</td>" ) ); + + assertThat( htmlContent, + containsString( "<tr class=\"b\">" + + "<td><a href=\"#surefire\">surefire</a></td>" + + "<td>1</td><td>1</td><td>0</td><td>0</td><td>0%</td><td>0</td>" + + "</tr>" ) ); + assertThat( htmlContent, + containsString( "<tr class=\"b\">" + + "<td>" + + "<a href=\"#surefireMyTest$A\">" + + "<img src=\"images/icon_error_sml.gif\" alt=\"\" />" + + "</a>" + + "</td>" + + "<td><a href=\"#surefireMyTest$A\">MyTest$A</a></td>" + + "<td>1</td><td>1</td><td>0</td><td>0</td><td>0%</td><td>0</td>" + + "</tr>" ) ); + + assertThat( htmlContent, containsString( ">surefire.MyTest$A:45</a>" ) ); + + assertThat( htmlContent, containsString( "./xref-test/surefire/MyTest$A.html#45" ) ); + + assertThat( htmlContent, containsString( "<pre>" + + "java.lang.RuntimeException: java.lang.IndexOutOfBoundsException\r\n" + + "\tat surefire.MyTest.rethrownDelegate(MyTest.java:24)\r\n" + + "\tat surefire.MyTest.newRethrownDelegate(MyTest.java:17)\r\n" + + "\tat surefire.MyTest.access$200(MyTest.java:9)\r\n" + + "\tat surefire.MyTest$A.t(MyTest.java:45)\r\n" + + "\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n" + + "\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)\r\n" + + "\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n" + + "\tat java.lang.reflect.Method.invoke(Method.java:606)\r\n" + + "\tat org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)\r\n" + + "\tat org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)\r\n" + + "\tat org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)\r\n" + + "\tat org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)\r\n" + + "\tat org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)\r\n" + + "\tat org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)\r\n" + + "\tat org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)\r\n" + + "\tat org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)\r\n" + + "\tat org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)\r\n" + + "\tat org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)\r\n" + + "\tat org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)\r\n" + + "\tat org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)\r\n" + + "\tat org.junit.runners.ParentRunner.run(ParentRunner.java:363)\r\n" + + "\tat org.junit.runners.Suite.runChild(Suite.java:128)\r\n" + + "\tat org.junit.runners.Suite.runChild(Suite.java:27)\r\n" + + "\tat org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)\r\n" + + "\tat org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)\r\n" + + "\tat org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)\r\n" + + "\tat org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)\r\n" + + "\tat org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)\r\n" + + "\tat org.junit.runners.ParentRunner.run(ParentRunner.java:363)\r\n" + + "\tat org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:272)\r\n" + + "\tat org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:167)\r\n" + + "\tat org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:147)\r\n" + + "\tat org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:130)\r\n" + + "\tat org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:211)\r\n" + + "\tat org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:163)\r\n" + + "\tat org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:105)\r\n" + + "\tCaused by: java.lang.IndexOutOfBoundsException\r\n" + + "\tat surefire.MyTest.failure(MyTest.java:33)\r\n" + + "\tat surefire.MyTest.access$100(MyTest.java:9)\r\n" + + "\tat surefire.MyTest$Nested.run(MyTest.java:38)\r\n" + + "\tat surefire.MyTest.delegate(MyTest.java:29)\r\n" + + "\tat surefire.MyTest.rethrownDelegate(MyTest.java:22)" + + "</pre>" ) ); + } + /** * Renderer the sink from the report mojo. * http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/989479ea/maven-surefire-report-plugin/src/test/resources/surefire-597/TEST-surefire.MyTest.xml ---------------------------------------------------------------------- diff --git a/maven-surefire-report-plugin/src/test/resources/surefire-597/TEST-surefire.MyTest.xml b/maven-surefire-report-plugin/src/test/resources/surefire-597/TEST-surefire.MyTest.xml new file mode 100644 index 0000000..d425aa0 --- /dev/null +++ b/maven-surefire-report-plugin/src/test/resources/surefire-597/TEST-surefire.MyTest.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> +<testsuite name="surefire.MyTest" time="0" tests="1" errors="1" skipped="0" failures="0"> + <properties> + <property name="java.runtime.name" value="Java(TM) SE Runtime Environment"/> + </properties> + <testcase name="test" classname="surefire.MyTest" time="0.1"> + <error type="java.lang.RuntimeException" message="java.lang.IndexOutOfBoundsException: msg">java.lang.RuntimeException: java.lang.IndexOutOfBoundsException: msg + at surefire.MyTest.rethrownDelegate(MyTest.java:24) + at surefire.MyTest.newRethrownDelegate(MyTest.java:17) + at surefire.MyTest.test(MyTest.java:13) + at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) + at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) + at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) + at java.lang.reflect.Method.invoke(Method.java:606) + at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) + at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) + at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) + at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) + at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) + at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) + at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) + at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) + at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) + at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) + at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) + at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) + at org.junit.runners.ParentRunner.run(ParentRunner.java:363) + at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:272) + at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:167) + at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:147) + at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:130) + at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:211) + at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:163) + at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:105) + Caused by: java.lang.IndexOutOfBoundsException + at surefire.MyTest.failure(MyTest.java:33) + at surefire.MyTest.access$100(MyTest.java:9) + at surefire.MyTest$Nested.run(MyTest.java:38) + at surefire.MyTest.delegate(MyTest.java:29) + at surefire.MyTest.rethrownDelegate(MyTest.java:22) + ... 26 more +</error> + </testcase> +</testsuite> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/989479ea/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-enclosed-trimStackTrace/plugin-config.xml ---------------------------------------------------------------------- diff --git a/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-enclosed-trimStackTrace/plugin-config.xml b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-enclosed-trimStackTrace/plugin-config.xml new file mode 100644 index 0000000..5124e17 --- /dev/null +++ b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-enclosed-trimStackTrace/plugin-config.xml @@ -0,0 +1,38 @@ +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> + +<project> + <build> + <plugins> + <plugin> + <artifactId>maven-surefire-report-plugin</artifactId> + <configuration> + <outputDirectory>${basedir}/target/site/unit/surefire-report-enclosed-trimStackTrace</outputDirectory> + <project implementation="org.apache.maven.plugins.surefire.report.stubs.SurefireRepMavenProjectStub"/> + <showSuccess>true</showSuccess> + <reportsDirectory>${basedir}/src/test/resources/unit/surefire-report-enclosed-trimStackTrace/surefire-reports + </reportsDirectory> + <outputName>surefire-report</outputName> + <xrefLocation>${basedir}/target/site/unit/surefire-report-enclosed-trimStackTrace/xref-test</xrefLocation> + <linkXRef>true</linkXRef> + </configuration> + </plugin> + </plugins> + </build> +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/989479ea/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-enclosed-trimStackTrace/surefire-reports/TEST-surefire.MyTest-enclosed-trimStackTrace.xml ---------------------------------------------------------------------- diff --git a/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-enclosed-trimStackTrace/surefire-reports/TEST-surefire.MyTest-enclosed-trimStackTrace.xml b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-enclosed-trimStackTrace/surefire-reports/TEST-surefire.MyTest-enclosed-trimStackTrace.xml new file mode 100644 index 0000000..d5e68a2 --- /dev/null +++ b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-enclosed-trimStackTrace/surefire-reports/TEST-surefire.MyTest-enclosed-trimStackTrace.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<testsuite name="surefire.MyTest" time="0" tests="1" errors="1" skipped="0" failures="0"> + <properties> + <property name="java.runtime.name" value="Java(TM) SE Runtime Environment"/> + </properties> + <testcase name="t" classname="surefire.MyTest$A" time="0"> + <error message="java.lang.IndexOutOfBoundsException" type="java.lang.RuntimeException">java.lang.RuntimeException: java.lang.IndexOutOfBoundsException + at surefire.MyTest.failure(MyTest.java:33) + at surefire.MyTest.access$100(MyTest.java:9) + at surefire.MyTest$Nested.run(MyTest.java:38) + at surefire.MyTest.delegate(MyTest.java:29) + at surefire.MyTest.rethrownDelegate(MyTest.java:22) + at surefire.MyTest.newRethrownDelegate(MyTest.java:17) + at surefire.MyTest.access$200(MyTest.java:9) + at surefire.MyTest$A.t(MyTest.java:45) +</error> + </testcase> +</testsuite> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/989479ea/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-enclosed/plugin-config.xml ---------------------------------------------------------------------- diff --git a/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-enclosed/plugin-config.xml b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-enclosed/plugin-config.xml new file mode 100644 index 0000000..77c031e --- /dev/null +++ b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-enclosed/plugin-config.xml @@ -0,0 +1,38 @@ +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> + +<project> + <build> + <plugins> + <plugin> + <artifactId>maven-surefire-report-plugin</artifactId> + <configuration> + <outputDirectory>${basedir}/target/site/unit/surefire-report-enclosed</outputDirectory> + <project implementation="org.apache.maven.plugins.surefire.report.stubs.SurefireRepMavenProjectStub"/> + <showSuccess>true</showSuccess> + <reportsDirectory>${basedir}/src/test/resources/unit/surefire-report-enclosed/surefire-reports + </reportsDirectory> + <outputName>surefire-report</outputName> + <xrefLocation>${basedir}/target/site/unit/surefire-report-enclosed/xref-test</xrefLocation> + <linkXRef>true</linkXRef> + </configuration> + </plugin> + </plugins> + </build> +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/989479ea/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-enclosed/surefire-reports/TEST-surefire.MyTest-enclosed.xml ---------------------------------------------------------------------- diff --git a/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-enclosed/surefire-reports/TEST-surefire.MyTest-enclosed.xml b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-enclosed/surefire-reports/TEST-surefire.MyTest-enclosed.xml new file mode 100644 index 0000000..88402af --- /dev/null +++ b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-enclosed/surefire-reports/TEST-surefire.MyTest-enclosed.xml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<testsuite name="surefire.MyTest" time="0" tests="1" errors="1" skipped="0" failures="0"> + <properties> + <property name="java.runtime.name" value="Java(TM) SE Runtime Environment"/> + </properties> + <testcase name="t" classname="surefire.MyTest$A" time="0"> + <error message="java.lang.IndexOutOfBoundsException" type="java.lang.RuntimeException">java.lang.RuntimeException: java.lang.IndexOutOfBoundsException + at surefire.MyTest.rethrownDelegate(MyTest.java:24) + at surefire.MyTest.newRethrownDelegate(MyTest.java:17) + at surefire.MyTest.access$200(MyTest.java:9) + at surefire.MyTest$A.t(MyTest.java:45) + at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) + at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) + at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) + at java.lang.reflect.Method.invoke(Method.java:606) + at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) + at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) + at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) + at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) + at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) + at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) + at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) + at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) + at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) + at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) + at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) + at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) + at org.junit.runners.ParentRunner.run(ParentRunner.java:363) + at org.junit.runners.Suite.runChild(Suite.java:128) + at org.junit.runners.Suite.runChild(Suite.java:27) + at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) + at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) + at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) + at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) + at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) + at org.junit.runners.ParentRunner.run(ParentRunner.java:363) + at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:272) + at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:167) + at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:147) + at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:130) + at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:211) + at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:163) + at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:105) + Caused by: java.lang.IndexOutOfBoundsException + at surefire.MyTest.failure(MyTest.java:33) + at surefire.MyTest.access$100(MyTest.java:9) + at surefire.MyTest$Nested.run(MyTest.java:38) + at surefire.MyTest.delegate(MyTest.java:29) + at surefire.MyTest.rethrownDelegate(MyTest.java:22) +</error> + </testcase> +</testsuite> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/989479ea/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-nestedClass-trimStackTrace/plugin-config.xml ---------------------------------------------------------------------- diff --git a/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-nestedClass-trimStackTrace/plugin-config.xml b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-nestedClass-trimStackTrace/plugin-config.xml new file mode 100644 index 0000000..d32358a --- /dev/null +++ b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-nestedClass-trimStackTrace/plugin-config.xml @@ -0,0 +1,38 @@ +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> + +<project> + <build> + <plugins> + <plugin> + <artifactId>maven-surefire-report-plugin</artifactId> + <configuration> + <outputDirectory>${basedir}/target/site/unit/surefire-report-nestedClass-trimStackTrace</outputDirectory> + <project implementation="org.apache.maven.plugins.surefire.report.stubs.SurefireRepMavenProjectStub"/> + <showSuccess>true</showSuccess> + <reportsDirectory>${basedir}/src/test/resources/unit/surefire-report-nestedClass-trimStackTrace/surefire-reports + </reportsDirectory> + <outputName>surefire-report</outputName> + <xrefLocation>${basedir}/target/site/unit/surefire-report-nestedClass-trimStackTrace/xref-test</xrefLocation> + <linkXRef>true</linkXRef> + </configuration> + </plugin> + </plugins> + </build> +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/989479ea/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-nestedClass-trimStackTrace/surefire-reports/TEST-surefire.MyTest-nestedClass-trimStackTrace.xml ---------------------------------------------------------------------- diff --git a/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-nestedClass-trimStackTrace/surefire-reports/TEST-surefire.MyTest-nestedClass-trimStackTrace.xml b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-nestedClass-trimStackTrace/surefire-reports/TEST-surefire.MyTest-nestedClass-trimStackTrace.xml new file mode 100644 index 0000000..5b5e9a6 --- /dev/null +++ b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-nestedClass-trimStackTrace/surefire-reports/TEST-surefire.MyTest-nestedClass-trimStackTrace.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<testsuite name="surefire.MyTest" time="0" tests="1" errors="1" skipped="0" failures="0"> + <properties> + <property name="java.runtime.name" value="Java(TM) SE Runtime Environment"/> + </properties> + <testcase name="test" classname="surefire.MyTest" time="0"> + <error message="java.lang.IndexOutOfBoundsException" type="java.lang.RuntimeException">java.lang.RuntimeException: java.lang.IndexOutOfBoundsException + at surefire.MyTest.rethrownDelegate(MyTest.java:24) + at surefire.MyTest.newRethrownDelegate(MyTest.java:17) + at surefire.MyTest.test(MyTest.java:13) + Caused by: java.lang.IndexOutOfBoundsException + at surefire.MyTest.failure(MyTest.java:33) + at surefire.MyTest.access$100(MyTest.java:9) + at surefire.MyTest$Nested.run(MyTest.java:38) + at surefire.MyTest.delegate(MyTest.java:29) + at surefire.MyTest.rethrownDelegate(MyTest.java:22) +</error> + </testcase> +</testsuite> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/989479ea/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-nestedClass/plugin-config.xml ---------------------------------------------------------------------- diff --git a/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-nestedClass/plugin-config.xml b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-nestedClass/plugin-config.xml new file mode 100644 index 0000000..7f27255 --- /dev/null +++ b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-nestedClass/plugin-config.xml @@ -0,0 +1,38 @@ +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> + +<project> + <build> + <plugins> + <plugin> + <artifactId>maven-surefire-report-plugin</artifactId> + <configuration> + <outputDirectory>${basedir}/target/site/unit/surefire-report-nestedClass</outputDirectory> + <project implementation="org.apache.maven.plugins.surefire.report.stubs.SurefireRepMavenProjectStub"/> + <showSuccess>true</showSuccess> + <reportsDirectory>${basedir}/src/test/resources/unit/surefire-report-nestedClass/surefire-reports + </reportsDirectory> + <outputName>surefire-report</outputName> + <xrefLocation>${basedir}/target/site/unit/surefire-report-nestedClass/xref-test</xrefLocation> + <linkXRef>true</linkXRef> + </configuration> + </plugin> + </plugins> + </build> +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/989479ea/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-nestedClass/surefire-reports/TEST-surefire.MyTest-nestedClass.xml ---------------------------------------------------------------------- diff --git a/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-nestedClass/surefire-reports/TEST-surefire.MyTest-nestedClass.xml b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-nestedClass/surefire-reports/TEST-surefire.MyTest-nestedClass.xml new file mode 100644 index 0000000..e92f215 --- /dev/null +++ b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-nestedClass/surefire-reports/TEST-surefire.MyTest-nestedClass.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<testsuite name="surefire.MyTest" time="0" tests="1" errors="1" skipped="0" failures="0"> + <properties> + <property name="java.runtime.name" value="Java(TM) SE Runtime Environment"/> + </properties> + <testcase name="test" classname="surefire.MyTest" time="0"> + <error message="java.lang.IndexOutOfBoundsException" type="java.lang.RuntimeException">java.lang.RuntimeException: java.lang.IndexOutOfBoundsException + at surefire.MyTest.rethrownDelegate(MyTest.java:24) + at surefire.MyTest.newRethrownDelegate(MyTest.java:17) + at surefire.MyTest.test(MyTest.java:13) + at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) + at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) + at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) + at java.lang.reflect.Method.invoke(Method.java:606) + at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) + at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) + at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) + at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) + at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) + at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) + at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) + at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) + at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) + at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) + at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) + at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) + at org.junit.runners.ParentRunner.run(ParentRunner.java:363) + at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:272) + at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:167) + at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:147) + at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:130) + at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:211) + at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:163) + at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:105) + Caused by: java.lang.IndexOutOfBoundsException + at surefire.MyTest.failure(MyTest.java:33) + at surefire.MyTest.access$100(MyTest.java:9) + at surefire.MyTest$Nested.run(MyTest.java:38) + at surefire.MyTest.delegate(MyTest.java:29) + at surefire.MyTest.rethrownDelegate(MyTest.java:22) +</error> + </testcase> +</testsuite> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/989479ea/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-single-error/plugin-config.xml ---------------------------------------------------------------------- diff --git a/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-single-error/plugin-config.xml b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-single-error/plugin-config.xml new file mode 100644 index 0000000..6bc56d9 --- /dev/null +++ b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-single-error/plugin-config.xml @@ -0,0 +1,38 @@ +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> + +<project> + <build> + <plugins> + <plugin> + <artifactId>maven-surefire-report-plugin</artifactId> + <configuration> + <outputDirectory>${basedir}/target/site/unit/surefire-report-single-error</outputDirectory> + <project implementation="org.apache.maven.plugins.surefire.report.stubs.SurefireRepMavenProjectStub"/> + <showSuccess>true</showSuccess> + <reportsDirectory>${basedir}/src/test/resources/unit/surefire-report-single-error/surefire-reports + </reportsDirectory> + <outputName>surefire-report</outputName> + <xrefLocation>${basedir}/target/site/unit/surefire-report-single-error/xref-test</xrefLocation> + <linkXRef>true</linkXRef> + </configuration> + </plugin> + </plugins> + </build> +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/989479ea/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-single-error/surefire-reports/TEST-surefire.MyTest.xml ---------------------------------------------------------------------- diff --git a/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-single-error/surefire-reports/TEST-surefire.MyTest.xml b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-single-error/surefire-reports/TEST-surefire.MyTest.xml new file mode 100644 index 0000000..8183118 --- /dev/null +++ b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-single-error/surefire-reports/TEST-surefire.MyTest.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<testsuite name="surefire.MyTest" time="0" tests="1" errors="1" skipped="0" failures="0"> + <properties> + <property name="java.runtime.name" value="Java(TM) SE Runtime Environment"/> + </properties> + <testcase name="test" classname="surefire.MyTest" time="0.1"> + <error type="java.lang.RuntimeException" message="this is different message">java.lang.RuntimeException: java.lang.IndexOutOfBoundsException + at surefire.MyTest.rethrownDelegate(MyTest.java:24) + at surefire.MyTest.newRethrownDelegate(MyTest.java:17) + at surefire.MyTest.test(MyTest.java:13) + at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) + at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) + at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) + at java.lang.reflect.Method.invoke(Method.java:606) + at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) + at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) + at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) + at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) + at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) + at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) + at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) + at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) + at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) + at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) + at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) + at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) + at org.junit.runners.ParentRunner.run(ParentRunner.java:363) + at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:272) + at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:167) + at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:147) + at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:130) + at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:211) + at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:163) + at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:105) + Caused by: java.lang.IndexOutOfBoundsException + at surefire.MyTest.failure(MyTest.java:33) + at surefire.MyTest.access$100(MyTest.java:9) + at surefire.MyTest$Nested.run(MyTest.java:38) + at surefire.MyTest.delegate(MyTest.java:29) + at surefire.MyTest.rethrownDelegate(MyTest.java:22) +</error> + </testcase> +</testsuite> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/989479ea/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 2cb412a..c802a4f 100644 --- a/pom.xml +++ b/pom.xml @@ -222,7 +222,7 @@ <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> - <version>3.8.1</version> + <version>4.12</version> <scope>test</scope> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/989479ea/surefire-integration-tests/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/pom.xml b/surefire-integration-tests/pom.xml index d1171d5..9767021 100644 --- a/surefire-integration-tests/pom.xml +++ b/surefire-integration-tests/pom.xml @@ -59,12 +59,6 @@ <scope>test</scope> </dependency> <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.11</version> - <scope>test</scope> - </dependency> - <dependency> <groupId>net.sourceforge.htmlunit</groupId> <artifactId>htmlunit</artifactId> <version>2.8</version> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/989479ea/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire224WellFormedXmlFailuresIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire224WellFormedXmlFailuresIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire224WellFormedXmlFailuresIT.java index 5a6312b..1118b85 100644 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire224WellFormedXmlFailuresIT.java +++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire224WellFormedXmlFailuresIT.java @@ -71,10 +71,10 @@ public class Surefire224WellFormedXmlFailuresIT testU0000 = current; } } - assertEquals( "Wrong error message", "\"", testQuote.getFailure().get( "message" ) ); - assertEquals( "Wrong error message", "<", testLower.getFailure().get( "message" ) ); - assertEquals( "Wrong error message", ">", testGreater.getFailure().get( "message" ) ); + assertEquals( "Wrong error message", "\"", testQuote.getFailureMessage() ); + assertEquals( "Wrong error message", "<", testLower.getFailureMessage() ); + assertEquals( "Wrong error message", ">", testGreater.getFailureMessage() ); // SUREFIRE-456 we have to doubly-escape non-visible control characters like \u0000 - assertEquals( "Wrong error message", "�", testU0000.getFailure().get( "message" ) ); + assertEquals( "Wrong error message", "�", testU0000.getFailureMessage() ); } } http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/989479ea/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 78cd31c..e66b853 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 @@ -150,7 +150,7 @@ public class SmartStackTraceParserTest { SmartStackTraceParser smartStackTraceParser = new SmartStackTraceParser( CaseThatWillFail.class, e ); String res = smartStackTraceParser.getString(); - assertEquals( "CaseThatWillFail.testThatWillFail:29 expected:<abc> but was:<def>", res ); + assertEquals( "CaseThatWillFail.testThatWillFail:29 expected:<[abc]> but was:<[def]>", res ); } } @@ -190,7 +190,7 @@ public class SmartStackTraceParserTest { SmartStackTraceParser smartStackTraceParser = new SmartStackTraceParser( AssertionNoMessage.class, e ); String res = smartStackTraceParser.getString(); - assertEquals( "AssertionNoMessage.testThrowSomething:29 expected:<abc> but was:<xyz>", res ); + assertEquals( "AssertionNoMessage.testThrowSomething:29 expected:<[abc]> but was:<[xyz]>", res ); } } http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/989479ea/surefire-report-parser/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-report-parser/pom.xml b/surefire-report-parser/pom.xml index c86f9f4..2ed31da 100644 --- a/surefire-report-parser/pom.xml +++ b/surefire-report-parser/pom.xml @@ -57,8 +57,8 @@ <dependencies> <dependency> <groupId>org.apache.maven.surefire</groupId> - <artifactId>surefire-shadefire</artifactId> - <version>2.12.4</version> <!-- ${shadedVersion}, but resolved due to http://jira.codehaus.org/browse/MRELEASE-799 --> + <artifactId>surefire-junit47</artifactId> + <version>2.12.4</version> </dependency> </dependencies> </plugin> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/989479ea/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/ReportTestCase.java ---------------------------------------------------------------------- diff --git a/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/ReportTestCase.java b/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/ReportTestCase.java index 3203f49..96df5b8 100644 --- a/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/ReportTestCase.java +++ b/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/ReportTestCase.java @@ -19,13 +19,12 @@ package org.apache.maven.plugins.surefire.report; * under the License. */ -import java.util.HashMap; -import java.util.Map; +import org.apache.maven.shared.utils.StringUtils; /** * */ -public class ReportTestCase +public final class ReportTestCase { private String fullClassName; @@ -37,16 +36,25 @@ public class ReportTestCase private float time; - private Map<String, Object> failure; + private String failureMessage; + + private String failureType; + + private String failureErrorLine; + + private String failureDetail; + + private boolean hasFailure; public String getName() { return name; } - public void setName( String name ) + public ReportTestCase setName( String name ) { this.name = name; + return this; } public String getFullClassName() @@ -54,9 +62,10 @@ public class ReportTestCase return fullClassName; } - public void setFullClassName( String name ) + public ReportTestCase setFullClassName( String name ) { - this.fullClassName = name; + fullClassName = name; + return this; } public String getClassName() @@ -64,9 +73,10 @@ public class ReportTestCase return className; } - public void setClassName( String name ) + public ReportTestCase setClassName( String name ) { - this.className = name; + className = name; + return this; } public float getTime() @@ -74,14 +84,10 @@ public class ReportTestCase return time; } - public void setTime( float time ) + public ReportTestCase setTime( float time ) { this.time = time; - } - - public Map<String, Object> getFailure() - { - return failure; + return this; } public String getFullName() @@ -89,16 +95,65 @@ public class ReportTestCase return fullName; } - public void setFullName( String fullName ) + public ReportTestCase setFullName( String fullName ) { this.fullName = fullName; + return this; + } + + public String getFailureMessage() + { + return failureMessage; + } + + private ReportTestCase setFailureMessage( String failureMessage ) + { + this.failureMessage = failureMessage; + return this; + } + + public String getFailureType() + { + return failureType; + } + + private ReportTestCase setFailureType( String failureType ) + { + this.failureType = failureType; + return this; + } + + public String getFailureErrorLine() + { + return failureErrorLine; + } + + public ReportTestCase setFailureErrorLine( String failureErrorLine ) + { + this.failureErrorLine = failureErrorLine; + return this; + } + + public String getFailureDetail() + { + return failureDetail; + } + + public ReportTestCase setFailureDetail( String failureDetail ) + { + this.failureDetail = failureDetail; + return this; + } + + public ReportTestCase setFailure( String message, String type ) + { + hasFailure = StringUtils.isNotBlank( type ); + return setFailureMessage( message ).setFailureType( type ); } - public void addFailure( String message, String type ) + public boolean hasFailure() { - failure = new HashMap<String, Object>(); - failure.put( "message", message ); - failure.put( "type", type ); + return hasFailure; } /**