massive-oss / mcover

A cross platform code coverage framework for Haxe with testing and profiling applications. Supports AVM1, AVM2, JavaScript, C++, PHP and Neko.
Other
59 stars 9 forks source link

Allow CoverageLogger to start/stop/resume recording coverage for currentTest #10

Closed misprintt closed 12 years ago

misprintt commented 12 years ago

Currently CoverageLogger.currentTest provides a mechanism for recording a temporary set of statement and branch results. This is used in MUnit to calculate an accurate percentage for the current class irrespective while it's tests are running.

MUnit 2 will support running tests out of order (i.e. not run all tests in a single class sequentially). Proposal is to extend the 'currentTest' to cache each filter set and resume recording to it each time currentTest is set to the same value.

logger.currentTest = "Foo"
//Foo coverage now at 0%
//run FooTest.doSomething()
//Foo coverage now at 50%
logger.currentTest = "Bar";
//run BarTest.doSomething()
logger.currentTest = "Foo"
//run FooTest.doSomethingElse()
//Foo coverage now at 75%