Hi,
I'm using flexmojos4-alpha-3 and I reach a timeout when I enable the
coverage report. I tried to increase the timeout value
(<testTimeout>1800000</testTimeout>) but it wasn't still enough. Yes,
my flex project is quite large...
Looking at the flexmojos sources, I noticed the report is created in
XML and then converted to string before sending to the socket. XML
edition in flex is very expensive, so I changed the code to use String
instead of XML. Now the build completes in less than 3mn (rather than
still timeout after 30mn).
Could you please integrate this optimization in flexmojos 4 ? Here is
the diff:
Index: src/main/flex/org/sonatype/flexmojos/test/report/
TestCaseReport.as
===================================================================
--- src/main/flex/org/sonatype/flexmojos/test/report/TestCaseReport.as
(revision 1874)
+++ src/main/flex/org/sonatype/flexmojos/test/report/TestCaseReport.as
(working copy)
@@ -87,6 +87,27 @@
return genxml;
}
+ public function toXmlString():String
+ {
+
+ var genxml:String = "<testsuite errors='"+ errors +
+ "' failures='"+failures+
+ "' name='" + name.replace( "::", "." ) +
+ "' tests='"+tests +
+ "' time='"+ time + "' >";
+
+ for each ( var methodReport:TestMethodReport in methods )
+ {
+ genxml += methodReport.toXml().toXMLString();
+ }
+
+ var data:Object =
CoverageDataCollector.extractCoverageResult();
+ for ( var cls:String in data )
+ {
+ genxml +=
TestCoverageReport(data[cls]).toXmlString() ;
+ }
+ return genxml + "</testsuite>";
+ }
}
}
\ No newline at end of file
Index: src/main/flex/org/sonatype/flexmojos/test/report/
TestCoverageReport.as
===================================================================
--- src/main/flex/org/sonatype/flexmojos/test/report/
TestCoverageReport.as (revision 1874)
+++ src/main/flex/org/sonatype/flexmojos/test/report/
TestCoverageReport.as (working copy)
@@ -42,6 +42,19 @@
return XML(genxml);
}
+ public function toXmlString():String
+ {
+ var genxml:String = "<coverage classname=\""+ classname +
"\">";
+
+ for each ( var line:int in touchs )
+ {
+ genxml = genxml.concat("<touch>",line,"</touch>");
+ }
+
+ genxml += "</coverage>";
+
+ return genxml;
+ }
}
}
\ No newline at end of file
Index: src/main/flex/org/sonatype/flexmojos/unitestingsupport/
SocketReporter.as
===================================================================
--- src/main/flex/org/sonatype/flexmojos/unitestingsupport/
SocketReporter.as (revision 1874)
+++ src/main/flex/org/sonatype/flexmojos/unitestingsupport/
SocketReporter.as (working copy)
@@ -140,10 +140,7 @@
{
var testReport:TestCaseReport = reports[ className ];
// Create the XML report.
- var xml:XML = testReport.toXml();
-
- var xmlString:String = xml.toXMLString();
-
+ var xmlString:String = testReport.toXmlString();
// Send the XML report.
socket.send( xmlString );
}
Regards,
-phk-
--
You received this message because you are subscribed to the Google
Groups "Flex Mojos" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/flex-mojos
http://flexmojos.sonatype.org/