maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agud...@apache.org
Subject git commit: [SUREFIRE-970] Fix elapsed time time of failed and skipped tests
Date Mon, 25 Mar 2013 19:37:51 GMT
Updated Branches:
  refs/heads/master 4221437cb -> a57b805f4


[SUREFIRE-970] Fix elapsed time time of failed and skipped tests

o time measurement is now limited to TestSetRunListener, except for concurrent junit tests


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

Branch: refs/heads/master
Commit: a57b805f4c079b40ae549e8a22be2f5de006d580
Parents: 4221437
Author: Andreas Gudian <agudian@apache.org>
Authored: Mon Mar 25 20:37:20 2013 +0100
Committer: Andreas Gudian <agudian@apache.org>
Committed: Mon Mar 25 20:37:20 2013 +0100

----------------------------------------------------------------------
 .../surefire/report/PrettyPrintXMLWriter.java      |    7 +-
 .../plugin/surefire/report/TestSetRunListener.java |   40 +++++--
 .../plugin/surefire/report/WrappedReportEntry.java |    3 +-
 .../maven/surefire/booter/ForkingRunListener.java  |   13 ++-
 .../its/jiras/Surefire943ReportContentIT.java      |   85 ++++++++++++---
 .../src/test/java/org/sample/module/My1Test.java   |   11 ++
 .../src/test/java/org/sample/module/My2Test.java   |   11 ++
 .../src/test/java/org/sample/module/My3Test.java   |    5 +-
 .../src/test/java/org/sample/module/My4Test.java   |   27 +++++
 .../junitcore/NonConcurrentRunListener.java        |   27 +++--
 .../maven/surefire/junitcore/TestMethod.java       |   18 ++--
 11 files changed, 187 insertions(+), 60 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/a57b805f/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/PrettyPrintXMLWriter.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/PrettyPrintXMLWriter.java
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/PrettyPrintXMLWriter.java
index ddb4ed9..b0fea62 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/PrettyPrintXMLWriter.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/PrettyPrintXMLWriter.java
@@ -21,9 +21,8 @@ package org.apache.maven.plugin.surefire.report;
 
 import java.io.PrintWriter;
 import java.util.LinkedList;
-import org.apache.maven.shared.utils.xml.XMLWriter;
 
-import sun.reflect.generics.reflectiveObjects.NotImplementedException;
+import org.apache.maven.shared.utils.xml.XMLWriter;
 
 public class PrettyPrintXMLWriter
     implements XMLWriter
@@ -69,12 +68,12 @@ public class PrettyPrintXMLWriter
 
     public void setEncoding( String encoding )
     {
-        throw new NotImplementedException();
+        throw new RuntimeException( "Not Implemented" );
     }
 
     public void setDocType( String docType )
     {
-        throw new NotImplementedException();
+        throw new RuntimeException( "Not Implemented" );
     }
 
     private PrettyPrintXMLWriter( PrintWriter writer, String encoding, String doctype )

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/a57b805f/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java
index 230e0e7..c366435 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java
@@ -33,7 +33,7 @@ import org.apache.maven.surefire.util.internal.ByteBuffer;
 /**
  * Reports data for a single test set.
  * <p/>
- *
+ * 
  * @author Kristian Rosenvold
  */
 public class TestSetRunListener
@@ -62,8 +62,8 @@ public class TestSetRunListener
     public TestSetRunListener( ConsoleReporter consoleReporter, FileReporter fileReporter,
                                StatelessXmlReporter simpleXMLReporter,
                                TestcycleConsoleOutputReceiver consoleOutputReceiver,
-                               StatisticsReporter statisticsReporter, RunStatistics globalStats,
boolean trimStackTrace,
-                               boolean isPlainFormat, boolean briefOrPlainFormat )
+                               StatisticsReporter statisticsReporter, RunStatistics globalStats,
+                               boolean trimStackTrace, boolean isPlainFormat, boolean briefOrPlainFormat
)
     {
         this.consoleReporter = consoleReporter;
         this.fileReporter = fileReporter;
@@ -115,7 +115,7 @@ public class TestSetRunListener
 
     public void testSetCompleted( ReportEntry report )
     {
-        WrappedReportEntry wrap = wrapTestSet( report, null );
+        WrappedReportEntry wrap = wrapTestSet( report );
         List<String> testResults = briefOrPlainFormat ? detailsForThis.getTestResults()
: null;
         if ( consoleReporter != null )
         {
@@ -195,7 +195,6 @@ public class TestSetRunListener
 
     public void testSkipped( ReportEntry reportEntry )
     {
-
         WrappedReportEntry wrapped = wrap( reportEntry, ReportEntryType.skipped );
         detailsForThis.testSkipped( wrapped );
         if ( statisticsReporter != null )
@@ -225,16 +224,33 @@ public class TestSetRunListener
 
     private WrappedReportEntry wrap( ReportEntry other, ReportEntryType reportEntryType )
     {
-        return new WrappedReportEntry( other, reportEntryType, other.getElapsed() != null
-            ? other.getElapsed()
-            : detailsForThis.getElapsedSinceLastStart(), getAsString( testStdOut ), getAsString(
testStdErr ) );
+        final int estimatedElapsed;
+        if ( reportEntryType != ReportEntryType.skipped )
+        {
+            if ( other.getElapsed() != null )
+            {
+                estimatedElapsed = other.getElapsed();
+            }
+            else
+            {
+                estimatedElapsed = detailsForThis.getElapsedSinceLastStart();
+            }
+        }
+        else
+        {
+            estimatedElapsed = 0;
+        }
+
+        return new WrappedReportEntry( other, reportEntryType, estimatedElapsed, getAsString(
testStdOut ),
+                                       getAsString( testStdErr ) );
     }
 
-    private WrappedReportEntry wrapTestSet( ReportEntry other, ReportEntryType reportEntryType
)
+    private WrappedReportEntry wrapTestSet( ReportEntry other )
     {
-        return new WrappedReportEntry( other, reportEntryType, other.getElapsed() != null
-            ? other.getElapsed()
-            : detailsForThis.getElapsedSinceTestSetStart(), getAsString( testStdOut ), getAsString(
testStdErr ) );
+        return new WrappedReportEntry( other, null, other.getElapsed() != null 
+                        ? other.getElapsed()
+                        : detailsForThis.getElapsedSinceTestSetStart(), getAsString( testStdOut
),
+                                       getAsString( testStdErr ) );
     }
 
     public void close()

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/a57b805f/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/WrappedReportEntry.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/WrappedReportEntry.java
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/WrappedReportEntry.java
index c77867c..fa941f7 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/WrappedReportEntry.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/WrappedReportEntry.java
@@ -58,10 +58,9 @@ public class WrappedReportEntry
 
     public Integer getElapsed()
     {
-        return original.getElapsed() != null ? original.getElapsed() : elapsed;
+        return elapsed;
     }
 
-
     public ReportEntryType getReportEntryType()
     {
         return reportEntryType;

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/a57b805f/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingRunListener.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingRunListener.java
b/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingRunListener.java
index fa4e9cf..d20fcf2 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingRunListener.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/booter/ForkingRunListener.java
@@ -132,7 +132,6 @@ public class ForkingRunListener
         target.print( toString( BOOTERCODE_TEST_ERROR, report, testSetChannelId ) );
     }
 
-
     public void testFailed( ReportEntry report )
     {
         target.print( toString( BOOTERCODE_TEST_FAILED, report, testSetChannelId ) );
@@ -233,8 +232,10 @@ public class ForkingRunListener
     private String toPropertyString( String key, String value )
     {
         StringBuffer stringBuffer = new StringBuffer();
-        append( stringBuffer, BOOTERCODE_SYSPROPS ).comma( stringBuffer );
-        append( stringBuffer, Integer.toHexString( testSetChannelId.intValue() ) ).comma(
stringBuffer );
+        append( stringBuffer, BOOTERCODE_SYSPROPS );
+        comma( stringBuffer );
+        append( stringBuffer, Integer.toHexString( testSetChannelId.intValue() ) );
+        comma( stringBuffer );
         StringUtils.escapeJavaStyleString( stringBuffer, key );
         append( stringBuffer, "," );
         StringUtils.escapeJavaStyleString( stringBuffer, value );
@@ -245,8 +246,10 @@ public class ForkingRunListener
     private String toString( byte operationCode, ReportEntry reportEntry, Integer testSetChannelId
)
     {
         StringBuffer stringBuffer = new StringBuffer();
-        append( stringBuffer, operationCode ).comma( stringBuffer );
-        append( stringBuffer, Integer.toHexString( testSetChannelId.intValue() ) ).comma(
stringBuffer );
+        append( stringBuffer, operationCode );
+        comma( stringBuffer );
+        append( stringBuffer, Integer.toHexString( testSetChannelId.intValue() ) );
+        comma( stringBuffer );
         nullableEncoding( stringBuffer, reportEntry.getSourceName() );
         comma( stringBuffer );
         nullableEncoding( stringBuffer, reportEntry.getName() );

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/a57b805f/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire943ReportContentIT.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire943ReportContentIT.java
b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire943ReportContentIT.java
index 5568c48..fe72087 100644
--- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire943ReportContentIT.java
+++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire943ReportContentIT.java
@@ -1,4 +1,5 @@
 package org.apache.maven.surefire.its.jiras;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -18,7 +19,6 @@ package org.apache.maven.surefire.its.jiras;
  * under the License.
  */
 
-
 import java.io.FileNotFoundException;
 import org.apache.maven.shared.utils.xml.Xpp3Dom;
 import org.apache.maven.shared.utils.xml.Xpp3DomBuilder;
@@ -33,26 +33,57 @@ public class Surefire943ReportContentIT
 {
 
     @Test
-    public void test()
+    public void test_noParallel()
         throws Exception
     {
-        OutputValidator validator = unpack( "surefire-943-report-content" ).maven().withFailure().executeTest();
-        validator.assertTestSuiteResults( 6, 0, 3, 0 );
+        doTest( "none" );
+    }
 
-        validate( validator, "org.sample.module.My1Test" );
-        validate( validator, "org.sample.module.My2Test" );
-        validate( validator, "org.sample.module.My3Test" );
+    @Test
+    public void test_parallelBoth()
+        throws Exception
+    {
+        doTest( "both" );
     }
 
-    private void validate( OutputValidator validator, String className )
+    private void doTest( String parallelMode )
+        throws Exception
+    {
+        OutputValidator validator =
+            unpack( "surefire-943-report-content" ).maven().sysProp( "parallel", parallelMode
).withFailure().executeTest();
+        validator.assertTestSuiteResults( 9, 0, 3, 3 );
+
+        validate( validator, "org.sample.module.My1Test", 1 );
+        validate( validator, "org.sample.module.My2Test", 1 );
+        validate( validator, "org.sample.module.My3Test", 0 );
+        validateSkipped( validator, "org.sample.module.My4Test" );
+    }
+
+    private void validateSkipped( OutputValidator validator, String className )
         throws FileNotFoundException
     {
-        Xpp3Dom testResult =
-            Xpp3DomBuilder.build( validator.getSurefireReportsXmlFile( "TEST-" + className
+ ".xml" ).getFileInputStream(),
-                                  "UTF-8" );
-        Xpp3Dom[] children = testResult.getChildren( "testcase" );
+        Xpp3Dom[] children = readTests( validator, className );
 
-        Assert.assertEquals( 2, children.length );
+        Assert.assertEquals( 1, children.length );
+
+        Xpp3Dom child = children[0];
+
+        Assert.assertEquals( className, child.getAttribute( "classname" ) );
+        Assert.assertEquals( className, child.getAttribute( "name" ) );
+
+        Assert.assertEquals( "Expected skipped tag for ignored method for " + className,
1,
+                             child.getChildren( "skipped" ).length );
+
+        Assert.assertTrue( "time for ignored test is expected to be zero",
+                           Double.compare( Double.parseDouble( child.getAttribute( "time"
) ), 0.0d ) == 0 );
+    }
+
+    private void validate( OutputValidator validator, String className, int ignored )
+        throws FileNotFoundException
+    {
+        Xpp3Dom[] children = readTests( validator, className );
+
+        Assert.assertEquals( 2 + ignored, children.length );
 
         for ( Xpp3Dom child : children )
         {
@@ -62,15 +93,39 @@ public class Surefire943ReportContentIT
             {
                 Assert.assertEquals( "Expected no failures for method alwaysSuccessful for
" + className, 0,
                                      child.getChildCount() );
+
+                Assert.assertTrue( "time for successful test is expected to be positive",
+                                   Double.compare( Double.parseDouble( child.getAttribute(
"time" ) ), 0.0d ) > 0 );
+            }
+            else if ( child.getAttribute( "name" ).contains( "Ignored" ) )
+            {
+                Assert.assertEquals( "Expected skipped-tag for ignored method for " + className,
1,
+                                     child.getChildren( "skipped" ).length );
+
+                Assert.assertTrue( "time for ignored test is expected to be zero",
+                                   Double.compare( Double.parseDouble( child.getAttribute(
"time" ) ), 0.0d ) == 0 );
+
             }
             else
             {
-                Assert.assertEquals( "Expected methods \"alwaysSuccessful\" and \"fails\"
in " + className, "fails",
-                                     child.getAttribute( "name" ) );
+                Assert.assertEquals( "Expected methods \"alwaysSuccessful\", \"*Ignored\"
and \"fails\" in "
+                    + className, "fails", child.getAttribute( "name" ) );
                 Assert.assertEquals( "Expected failure description for method \"fails\" in
" + className, 1,
                                      child.getChildren( "failure" ).length );
+                Assert.assertTrue( "time for failed test is expected to be positive",
+                                   Double.compare( Double.parseDouble( child.getAttribute(
"time" ) ), 0.0d ) > 0 );
             }
         }
     }
 
+    private Xpp3Dom[] readTests( OutputValidator validator, String className )
+        throws FileNotFoundException
+    {
+        Xpp3Dom testResult =
+            Xpp3DomBuilder.build( validator.getSurefireReportsXmlFile( "TEST-" + className
+ ".xml" ).getFileInputStream(),
+                                  "UTF-8" );
+        Xpp3Dom[] children = testResult.getChildren( "testcase" );
+        return children;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/a57b805f/surefire-integration-tests/src/test/resources/surefire-943-report-content/src/test/java/org/sample/module/My1Test.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/surefire-943-report-content/src/test/java/org/sample/module/My1Test.java
b/surefire-integration-tests/src/test/resources/surefire-943-report-content/src/test/java/org/sample/module/My1Test.java
index b2a2919..a5b5b61 100644
--- a/surefire-integration-tests/src/test/resources/surefire-943-report-content/src/test/java/org/sample/module/My1Test.java
+++ b/surefire-integration-tests/src/test/resources/surefire-943-report-content/src/test/java/org/sample/module/My1Test.java
@@ -6,17 +6,28 @@ import java.lang.management.ManagementFactory;
 
 import org.junit.Before;
 import org.junit.Test;
+import org.junit.Ignore;
 
 public class My1Test
 {
     @Test
     public void fails()
+        throws Exception
     {
+        Thread.sleep( 100 );
         fail( "Always fails" );
     }
 
     @Test
     public void alwaysSuccessful()
+        throws Exception
+    {
+        Thread.sleep( 100 );
+    }
+
+    @Test
+    @Ignore( "Ignore-Message" )
+    public void alwaysIgnored()
     {
 
     }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/a57b805f/surefire-integration-tests/src/test/resources/surefire-943-report-content/src/test/java/org/sample/module/My2Test.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/surefire-943-report-content/src/test/java/org/sample/module/My2Test.java
b/surefire-integration-tests/src/test/resources/surefire-943-report-content/src/test/java/org/sample/module/My2Test.java
index 7f70c76..a9b6a0a 100644
--- a/surefire-integration-tests/src/test/resources/surefire-943-report-content/src/test/java/org/sample/module/My2Test.java
+++ b/surefire-integration-tests/src/test/resources/surefire-943-report-content/src/test/java/org/sample/module/My2Test.java
@@ -6,16 +6,27 @@ import java.lang.management.ManagementFactory;
 
 import org.junit.Before;
 import org.junit.Test;
+import org.junit.Ignore;
 
 public class My2Test {
     @Test
     public void fails()
+        throws Exception
     {
+        Thread.sleep( 100 );
         fail( "Always fails" );
     }
 
     @Test
     public void alwaysSuccessful()
+        throws Exception
+    {
+        Thread.sleep( 100 );
+    }
+    
+    @Test
+    @Ignore
+    public void alwaysIgnored()
     {
 
     }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/a57b805f/surefire-integration-tests/src/test/resources/surefire-943-report-content/src/test/java/org/sample/module/My3Test.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/surefire-943-report-content/src/test/java/org/sample/module/My3Test.java
b/surefire-integration-tests/src/test/resources/surefire-943-report-content/src/test/java/org/sample/module/My3Test.java
index bb2a06b..5f5b2cd 100644
--- a/surefire-integration-tests/src/test/resources/surefire-943-report-content/src/test/java/org/sample/module/My3Test.java
+++ b/surefire-integration-tests/src/test/resources/surefire-943-report-content/src/test/java/org/sample/module/My3Test.java
@@ -10,13 +10,16 @@ import org.junit.Test;
 public class My3Test {
     @Test
     public void fails()
+        throws Exception
     {
+        Thread.sleep( 100 );
         fail( "Always fails" );
     }
 
     @Test
     public void alwaysSuccessful()
+        throws Exception
     {
-
+        Thread.sleep( 100 );
     }
 }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/a57b805f/surefire-integration-tests/src/test/resources/surefire-943-report-content/src/test/java/org/sample/module/My4Test.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/surefire-943-report-content/src/test/java/org/sample/module/My4Test.java
b/surefire-integration-tests/src/test/resources/surefire-943-report-content/src/test/java/org/sample/module/My4Test.java
new file mode 100644
index 0000000..7124d61
--- /dev/null
+++ b/surefire-integration-tests/src/test/resources/surefire-943-report-content/src/test/java/org/sample/module/My4Test.java
@@ -0,0 +1,27 @@
+package org.sample.module;
+
+import static org.junit.Assert.fail;
+
+import java.lang.management.ManagementFactory;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.Ignore;
+
+@Ignore( "Ignore-Message" )
+public class My4Test
+{
+
+    @Test
+    public void alsoIgnored()
+    {
+
+    }
+    
+    @Test
+    @Ignore
+    public void alwaysIgnored()
+    {
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/a57b805f/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/NonConcurrentRunListener.java
----------------------------------------------------------------------
diff --git a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/NonConcurrentRunListener.java
b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/NonConcurrentRunListener.java
index 240a40f..cf4d19d 100644
--- a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/NonConcurrentRunListener.java
+++ b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/NonConcurrentRunListener.java
@@ -30,18 +30,15 @@ import org.junit.runner.Result;
 import org.junit.runner.notification.Failure;
 
 /**
- * A class to be used when there is no JUnit parallelism (methods or/and class). This
- * allow to workaround JUnit limitation a la Junit4 provider. Specifically, we can redirect
- * properly the output even if we don't have class demarcation in JUnit. It works when
- * if there is a JVM instance per test run, i.e. with forkMode=always or perthread.
+ * A class to be used when there is no JUnit parallelism (methods or/and class). This allow
to workaround JUnit
+ * limitation a la Junit4 provider. Specifically, we can redirect properly the output even
if we don't have class
+ * demarcation in JUnit. It works when if there is a JVM instance per test run, i.e. with
forkMode=always or perthread.
  */
 public class NonConcurrentRunListener
     extends JUnit4RunListener
     implements ConsoleOutputReceiver
 {
 
-    private long startTime = System.currentTimeMillis();
-
     private java.lang.Class<?> currentTestClass;
 
     private Description lastFinishedDescription;
@@ -60,20 +57,26 @@ public class NonConcurrentRunListener
 
     protected SimpleReportEntry createReportEntry( Description description )
     {
-        return new SimpleReportEntry( description.getClassName(), description.getDisplayName(),
-                                      (int) ( System.currentTimeMillis() - startTime ) );
+        return new SimpleReportEntry( description.getClassName(), description.getDisplayName()/*,
+                                       (int) ( System.currentTimeMillis() - startTime ) */);
     }
 
     protected SimpleReportEntry createReportEntryForTestSet( Description description )
     {
-        return new SimpleReportEntry( description.getClassName(), description.getClassName(),
-                                      (int) ( System.currentTimeMillis() - startTime ) );
+        return new SimpleReportEntry( description.getClassName(), description.getClassName()
/*,
+                                       (int) ( System.currentTimeMillis() - startTime ) */);
     }
 
     @Override
     public void testStarted( Description description )
         throws Exception
     {
+        finishLastTestSetIfNeccessary( description );
+        super.testStarted( description );
+    }
+
+    private void finishLastTestSetIfNeccessary( Description description )
+    {
         if ( !description.getTestClass().equals( currentTestClass ) )
         {
             currentTestClass = description.getTestClass();
@@ -82,10 +85,8 @@ public class NonConcurrentRunListener
                 reporter.testSetCompleted( createReportEntryForTestSet( lastFinishedDescription
) );
                 lastFinishedDescription = null;
             }
-            startTime = System.currentTimeMillis();
             reporter.testSetStarting( createReportEntryForTestSet( description ) );
         }
-        super.testStarted( description );
     }
 
     @Override
@@ -100,6 +101,8 @@ public class NonConcurrentRunListener
     public void testIgnored( Description description )
         throws Exception
     {
+        finishLastTestSetIfNeccessary( description );
+
         super.testIgnored( description );
         this.lastFinishedDescription = description;
     }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/a57b805f/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/TestMethod.java
----------------------------------------------------------------------
diff --git a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/TestMethod.java
b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/TestMethod.java
index 041db34..cad3fd5 100644
--- a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/TestMethod.java
+++ b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/TestMethod.java
@@ -98,11 +98,12 @@ class TestMethod
 
         if ( ignored != null )
         {
-            reporter.testSkipped( createReportEntry() );
+            reporter.testSkipped( createReportEntry( ignored ) );
             return;
         }
 
-        reporter.testStarting( createReportEntry() );
+        ReportEntry descriptionReport = createReportEntry( description );
+        reporter.testStarting( descriptionReport );
         if ( output != null )
         {
             output.writeDetails( ( (ConsoleOutputReceiver) reporter ) );
@@ -110,23 +111,22 @@ class TestMethod
 
         if ( testFailure != null )
         {
-            reporter.testFailed( testFailure );
+            reporter.testFailed( createReportEntry( testFailure ) );
         }
         else if ( testError != null )
         {
-            reporter.testError( testError );
+            reporter.testError( createReportEntry( testError ) );
         }
         else
         {
-            reporter.testSucceeded( createReportEntry() );
+            reporter.testSucceeded( descriptionReport );
         }
     }
 
-    private ReportEntry createReportEntry()
+    private ReportEntry createReportEntry( ReportEntry reportEntry )
     {
-        int elapsed = (int) ( endTime - startTime );
-        return new CategorizedReportEntry( description.getSourceName(), description.getName(),
description.getGroup(),
-                                           description.getStackTraceWriter(), elapsed, description.getMessage()
);
+        return new CategorizedReportEntry( reportEntry.getSourceName(), reportEntry.getName(),
reportEntry.getGroup(),
+                                           reportEntry.getStackTraceWriter(), getElapsed(),
reportEntry.getMessage() );
     }
 
     public void attachToThread()


Mime
View raw message