My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
FlexcoverHints  
Flexcover Usage Hints
Updated Feb 4, 2010 by joseph.b...@gmail.com

Flexcover Usage Hints

No coverage information shown when relative paths used on command line (Bug 14)

If you are passing in filenames on the commandline to Flexcover, they must use absolute pathnames due to some unanticipated trickiness with AIR's handling of relative pathnames. Relative pathnames don't work! In other words, do this:

   CoverageViewer.exe -output c:/coverage/output.xml c:/coverage/ProjectX/bin/ProjectX.cvm

and not this:

   cd c:/coverage
   CoverageViewer.exe -output output.xml ProjectX/bin/ProjectX.cvm

"Not an SDK Directory" error in Flex Builder

If you modify an unpacked Flex SDK as directed in the install instructions, and then see an error message in Flex Builder that claims the resulting SDK directory is "not an SDK", the most likely reason is that you used the MacOS Finder or Windows Explorer to copy the modified SDK folders, and did so in a way that caused the complete replacement of the destination folders. Sticking with copy or cp on the command line will help avoid this problem, as in:

   cp ./sdk-modifications/* /Applications/Flexcover-sdk/

OutOfMemoryError during compilation

The Flexcover versions of mxmlc and compc are a little more memory-hungry than the originals. If your compile in Ant is failing in java with an OutOfMemoryError, try including the 'fork' and 'maxmemory' attribute in your compilation task, for example:

   <mxmlc fork="true" maxmemory="512m" ...>
       ...
   </mxmlc>

Automating Coverage Tests

It is possible to automate coverage measurements from unit test suites with flexcover -- it is a very important capability. In order to do so, you need to do the following:

1. start the CoverageViewer app from Ant and pass the .cvm file on the command line, plus the -output option to specify the .cvr file to which the report will be written. i.e.:

    CoverageViewer myProject.cvm -output myProject.cvr

2. have the unit tests call CoverageManager.exit() when they are done, rather than System.exit() or fscommand("quit"). If you're using flexunit2 or Antennae's test runner, you will need to change the code in the TestResultPrinter class to make this change. This ensures that all coverage data is flushed correctly before the program terminates. It also causes the CoverageViewer to write the output file and terminate itself when it receives the information that the instrumented app has terminated.

Comment by bpja...@gmail.com, Jul 9, 2008

The cp should be cp -r since the sdk-modifications contain dirs

Comment by james.se...@gmail.com, Sep 11, 2008

It should be noted that CoverageManager?.as is included with the sdk modifications.

Comment by liviu.au...@gmail.com, Jul 27, 2009

Related to "Automated Coverage Tests" point 2:

I hate hints. This is the full solution:

<FlexUnitTestRunnerApplication 
							   xmlns="*" xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:flexunit="flexunit.flexui.*"
							   testSuite="{ new AllTests() }"
							   testsComplete="getDefinitionByName('com.allurent.coverage.runtime.CoverageManager').exit()">
	<mx:Script>
		<![CDATA[
			import flash.utils.getDefinitionByName;
		]]>
	</mx:Script>

</FlexUnitTestRunnerApplication>
Comment by michael.bevz, Dec 28, 2009

Hi,

Do I have to add CoverageManager?.exit() call to Flexmojos TestRunner?? I can't figure it out.

Regards, Mike

Comment by iir...@gmail.com, Jan 8, 2010

Gee, it's far more complicated than using Java coverage tools like EMMA or Cobertura. They either use classloader instrumentation or bytecode instrumentation. To use FlexCover? I have to complicate my build process and use a modified SDK.

Is there a way of using FlexCover? with the original SDK, like in Java? Is it planned for implementation in the future?

Comment by maciej.b...@gmail.com, Jan 20, 2010

Where can I find working maven project supporting FlexCover?? It's a nightmare sofar :(

Comment by nahoul.l...@gmail.com, Mar 3, 2010

Hello,

I would like to know if the FlexCover? covers the AsDoc? or not ??

Thank you very much :)


Sign in to add a comment
Powered by Google Project Hosting