Skip to content

Instantly share code, notes, and snippets.

@FrancisBourre
Last active February 22, 2017 06:35
Show Gist options
  • Save FrancisBourre/9148024ef3ec7bddb74b5080934987c9 to your computer and use it in GitHub Desktop.
Save FrancisBourre/9148024ef3ec7bddb74b5080934987c9 to your computer and use it in GitHub Desktop.
Use MCover with hexUnit
static public function main() : Void
{
var emu = new ExMachinaUnitCore();
emu.addListener( new hex.unittest.notifier.BrowserUnitTestNotifier() );
emu.addListener( new LocalCodeCoverageListener() );
emu.addTest( HexCoreSuite );
emu.run();
}
private class LocalCodeCoverageListener implements ITestClassResultListener
{
var logger : CoverageLogger;
var client : PrintClient;
public function new()
{
this.logger = mcover.coverage.MCoverage.getLogger();
this.client = new PrintClient();
this.logger.addClient( client );
}
public function onStartRun( descriptor : TestClassDescriptor ) : Void{}
public function onEndRun( descriptor : TestClassDescriptor ) : Void
{
logger.report();
trace( this.client.output );
}
public function onSuiteClassStartRun( descriptor : TestClassDescriptor ) : Void{}
public function onSuiteClassEndRun( descriptor : TestClassDescriptor ) : Void{}
public function onTestClassStartRun( descriptor : TestClassDescriptor ) : Void{}
public function onTestClassEndRun( descriptor : TestClassDescriptor ) : Void{}
public function onSuccess( descriptor : TestClassDescriptor, timeElapsed : Float ) : Void{}
public function onFail( descriptor : TestClassDescriptor, timeElapsed : Float, error : Exception ) : Void{}
public function onTimeout( descriptor : TestClassDescriptor, timeElapsed : Float, error : Exception ) : Void{}
public function onIgnore( descriptor : TestClassDescriptor ) : Void{}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment