如何访问 FlexUnit 4 测试的测试名称?

发布于 2024-08-18 21:58:08 字数 195 浏览 5 评论 0原文

在 FlexUnit 1 中,可以使用 TestCase.getName() 方法访问当前运行的测试的名称,因为所有测试都是 TestCase 的子类。然而,在 FlexUnit 4 中,没有用于测试的基类;测试通过注释来标识。那么,如何在 FlexUnit 4 中复制 getName() 功能?

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() functionality in FlexUnit 4?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

策马西风 2024-08-25 21:58:08

您可以使用 FlexUnit 4.1 beta 2 或更高版本来执行此操作。请参阅 Michael Labriola 的回答,网址为 http://forums.adobe.com/thread/692994 ?tstart=0

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.

挽你眉间 2024-08-25 21:58:08

通过 解析 stacktrace

var tempError:Error = new Error();
var stackTrace:String = tempError.getStackTrace();

Get it by parsing the stacktrace:

var tempError:Error = new Error();
var stackTrace:String = tempError.getStackTrace();
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文