FlexUnit4:[Test(expect=“Error”)] 没有捕获错误?
以下代码产生失败的测试,而不是通过的测试(正如我所期望的):
[Test(expects="Error")]
public function someTest():void {
throw Error("this test doesn't pass");
}
The following code produces a failed test, not a passing test (as I would expect):
[Test(expects="Error")]
public function someTest():void {
throw Error("this test doesn't pass");
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在旧版本中,它是 [Test(expected='')]
在新版本中,我们支持预期和预期,因为这对许多人来说是令人困惑的
In older versions it was [Test(expected='')]
In newer versions we support both expected and expects as this was confusing for many
确保您链接的是 FlexUnit 的发行版 SWC,或者如果您自己编译它,请确保您在项目属性的“其他编译器选项”框中使用 --keep-as3-metadata+=Test。
Make sure you're linking against the release SWC of FlexUnit, or if you're compiling it yourself, make sure you're using --keep-as3-metadata+=Test in the "additional compiler options" box in project properties.
我认为问题可能是我使用的是旧版本的 FlexUnit4。我刚刚升级(到 4.0 RC1),它现在似乎可以工作了。
I think the problem may have been that I was using an older version of FlexUnit4. I just upgraded (to 4.0 RC1) and it seems to be working now.