FlexUnit4 的问题
我有点困惑,因为 FlexUnith 4 的行为。当我在 try-catch 主体中使用 failed() 时,失败方法被忽略。
[Test]
public function extend():void
{
try {
fail("This should fail");
} catch(er:Error) {}
}
我想这个应该失败,因为没有办法解决它,但它成功并变成绿色。我是什么做错了吗?当我将fail()放在try-catch块之前时,它会失败,因为它应该使用Flash builder 4。
I"m a bit confused because FlexUnith 4's behavior. When I use fail() in try-catch body fail method is just ignored.
[Test]
public function extend():void
{
try {
fail("This should fail");
} catch(er:Error) {}
}
I suppose this one should fail as there is no way around it, but it succeeds and turns green. Whatam I doing wrong? When i put fail() before try-catch block it fails as it is suposed to. BTW using Flash builder 4.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
向框架发出断言信号的方式是通过异常。
fail
也使用异常发送失败信号。那,以及Error
是所有异常的基类这一事实意味着没有异常会到达框架(您的try
/catch
块捕获所有异常),这意味着测试没有失败。The way assertions are signaled to the framework is through exceptions.
fail
sends the failure signal using an exception too. That, and the fact thatError
is the base class for all exceptions means that no exception will ever reach the framework (yourtry
/catch
block catches all excpetions), which means that the test didn't fail.