Search code examples
code-coveragehaxe

Code coverage in Haxe


Let's assume I have a Unit Test like this:

import haxe.unit.TestRunner;
import haxe.unit.TestCase;

class MyTests extends haxe.unit.TestCase {
    public function testSomething():Void {
        // ...
    }
    public function testSomethingElse():Void {
        // ...
    }
    public static function main():Void {
        var tr = new TestRunner();
        tr.add(new MyTests());
        tr.run();
    }
}

Now, after running my tests, I want to analyse, which lines of my code got tested and which not (code coverage) ... or at least see which functions of a certain class have been executed during test run (just to prevent that I do not have forgotten to test any functions). How can I do that?


Solution

  • MCover is currently the only real option at the moment. There is also one called coverme, but it’s not meant for public use yet.