Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In regards to FlexCover - the reason you are seeing it work sometimes and not others is the CoverageAgent is designed to exit the Unit Tests it does not communicate back to the CoverageViewer. I have created my own FlexCoverListener that sends an exit message over local connection to the CoverageViewer. Below is the code.</p> <pre><code>package org.flexunit.listeners { import flash.events.EventDispatcher; import org.flexunit.listeners.closer.FlexCoverCloser; import org.flexunit.runner.IDescription; import org.flexunit.runner.Result; import org.flexunit.runner.notification.Failure; import org.flexunit.runner.notification.IAsyncStartupRunListener; import org.flexunit.runner.notification.ITemporalRunListener; public class FlexCoverListener extends EventDispatcher implements IAsyncStartupRunListener, ITemporalRunListener { import com.allurent.coverage.runtime.CoverageManager; public function FlexCoverListener() { } public function get ready():Boolean { return true; } public function testTimed( description:IDescription, runTime:Number ):void { } public function testRunFinished( result:Result ):void { CoverageManager.agent.recordCoverage("SR_TESTS_COMPLETE"); } public function testFinished( description:IDescription ):void {} public function testRunStarted( description:IDescription ):void {} public function testStarted( description:IDescription ):void{} public function testFailure( failure:Failure ):void{} public function testAssumptionFailure( failure:Failure ):void{} public function testIgnored( description:IDescription ):void{} } } </code></pre> <p>You can add the above listener to your tests by doing the following in your TestRunner:</p> <pre><code>core.addListener(new FlexCoverListener()); var core : FlexUnitCore = new FlexUnitCore(); </code></pre> <p>Last but most importantly I changed the <code>recordCoverage</code> method in the <code>AbstractCoverageAgent</code> to look like the following:</p> <pre><code>/** * Record the execution of a single coverage key; called by * the global coverage() function. */ public function recordCoverage(key:String):void { if(key == "SR_TESTS_COMPLETE") { exit(); } else if (isNaN(coverageMap[key]++)) { // The map must not have contained this key yet, so enter an // execution count of 1. Subsequent calls will autoincrement without // returning NaN. // coverageMap[key] = 1; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload