Coverage

42 views
Skip to first unread message

Devboy

unread,
May 6, 2011, 6:21:46 PM5/6/11
to apparat-...@googlegroups.com
Hi,

I can't seem to find any info on how to use the coverage tool.
I can run it but how can i generate reports. The ouput file seems to be a swf too.

Is there any more info on using coverage?

Cheers,

Dominic

Joa Ebert

unread,
May 7, 2011, 6:42:04 AM5/7/11
to apparat-...@googlegroups.com
Hey Dominic,

this is a common missunderstanding. Apparat is not generating any coverage information. Instead it only allows the author of a tool to perform a coverage analysis when using a SWF that has been prepared by Apparat. FlexMojos is an example.

When you run the coverage tool Apparat will insert bytecode in the SWF that calls apparat.coverage.Coverage.onSample(file: String, line: int): void.
Imagine you have this code:

file:    Test.as
line0: var x: int = 1;
line1: trace(x);

Then Apparat will rewrite this as following:

import apparat.coverage.Coverage
Coverage.onSample('Test.as', 0);
var x: int = 1;
Coverage.onSample('Test.as', 1);

The implementation of the Coverage class is completely up to you. If it does not exist in the ApplicationDomain you will also get a runtime error. To fix this your test runner could either contain the Coverage class or it is already compiled into the SWF -- or you could use Apparat to inject some kind of class.

However in FlexMojos after a test suite completed the coverage data is sent back to the Java code via a socket and then it uses Cobertura to generate a report.


Best,

Joa

Dominic Graefen

unread,
May 7, 2011, 6:49:03 AM5/7/11
to apparat-...@googlegroups.com
Hi Joa,

thanks for the clarification. Might be worth a wiki-page ;)

I'll have a look at the flex-mojos implementation then.

Thanks,

-- 
Dominic Graefen

Reply all
Reply to author
Forward
0 new messages