maven-surefire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dfabul...@apache.org
Subject svn commit: r652186 - in /maven/surefire/trunk/maven-surefire-report-plugin/src: main/java/org/apache/maven/plugins/surefire/report/ test/java/org/apache/maven/plugins/surefire/report/ test/resources/test-reports/
Date Tue, 29 Apr 2008 23:09:51 GMT
Author: dfabulich
Date: Tue Apr 29 16:09:51 2008
New Revision: 652186

URL: http://svn.apache.org/viewvc?rev=652186&view=rev
Log:
[SUREFIRE-485] Support AntUnit XML output
Submitted by: Peter Janes

Added:
    maven/surefire/trunk/maven-surefire-report-plugin/src/test/resources/test-reports/TEST-AntUnit.xml
Modified:
    maven/surefire/trunk/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParser.java
    maven/surefire/trunk/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportParserTest.java

Modified: maven/surefire/trunk/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParser.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParser.java?rev=652186&r1=652185&r2=652186&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParser.java
(original)
+++ maven/surefire/trunk/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParser.java
Tue Apr 29 16:09:51 2008
@@ -84,9 +84,16 @@
             {
                 currentSuite = defaultSuite = new ReportTestSuite();
 
-                Number time = numberFormat.parse( attributes.getValue( "time" ) );
+                try
+                {
+                    Number time = numberFormat.parse( attributes.getValue( "time" ) );
 
-                defaultSuite.setTimeElapsed( time.floatValue() );
+                    defaultSuite.setTimeElapsed( time.floatValue() );
+                }
+                catch ( NullPointerException npe )
+                {
+                    System.err.println("WARNING: no time attribute found on testsuite element");
+                }
 
                 //check if group attribute is existing
                 if ( attributes.getValue( "group" ) != null && !"".equals( attributes.getValue(
"group" ) ) )
@@ -187,6 +194,17 @@
 
             error.put( "detail", parseCause( currentElement.toString() ) );
         }
+        else if ( "time".equals( qName ) )
+        {
+            try {
+                Number time = numberFormat.parse( currentElement.toString() );
+                defaultSuite.setTimeElapsed( time.floatValue() );
+            }
+            catch ( ParseException e )
+            {
+                throw new SAXException( e.getMessage(), e );
+            }
+        }
         // TODO extract real skipped reasons
     }
 

Modified: maven/surefire/trunk/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportParserTest.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportParserTest.java?rev=652186&r1=652185&r2=652186&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportParserTest.java
(original)
+++ maven/surefire/trunk/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportParserTest.java
Tue Apr 29 16:09:51 2008
@@ -55,7 +55,7 @@
 
         List suites = report.parseXMLReportFiles();
 
-        assertEquals( 7, suites.size() );
+        assertEquals( 8, suites.size() );
 
         Iterator it = suites.iterator();
         while ( it.hasNext() )

Added: maven/surefire/trunk/maven-surefire-report-plugin/src/test/resources/test-reports/TEST-AntUnit.xml
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-report-plugin/src/test/resources/test-reports/TEST-AntUnit.xml?rev=652186&view=auto
==============================================================================
--- maven/surefire/trunk/maven-surefire-report-plugin/src/test/resources/test-reports/TEST-AntUnit.xml
(added)
+++ maven/surefire/trunk/maven-surefire-report-plugin/src/test/resources/test-reports/TEST-AntUnit.xml
Tue Apr 29 16:09:51 2008
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<testsuite buildFile="/home/pjanes/devel/maven/client/tools/tests/changebase.xml" hostname="merope"
name="tests.changebase_xml" timestamp="2008-04-23T13:25:46">
+  <testcase name="testNegativeValue">
+    <time>0.378</time>
+  </testcase>
+  <tests>1</tests>
+  <failures>0</failures>
+  <errors>0</errors>
+  <time>0.378</time>
+</testsuite>



Mime
View raw message