Pergunta

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.

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top