How can I access the test name of a FlexUnit 4 test?
In FlexUnit 1 it is possible to access the name of the currently-running test using the TestCase.getName()
method because all tests subclass TestCase
. In FlexUnit 4, however, there's no base class for tests; the tests are identified by annotations. So, how can I replicate the getName()
functionalit开发者_如何学编程y in FlexUnit 4?
You can do this with FlexUnit 4.1 beta 2 or later. See the answer from Michael Labriola at http://forums.adobe.com/thread/692994?tstart=0.
Get it by parsing the stacktrace:
var tempError:Error = new Error();
var stackTrace:String = tempError.getStackTrace();
精彩评论