문제

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.

도움이 되었습니까?

해결책

The way assertions are signaled to the framework is through exceptions. fail sends the failure signal using an exception too. That, and the fact that Error is the base class for all exceptions means that no exception will ever reach the framework (your try/catch block catches all excpetions), which means that the test didn't fail.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top