erikandersen-pariveda / fluint

Automatically exported from code.google.com/p/fluint
0 stars 0 forks source link

Asynchronous expectations are still checked even after test failed #48

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create, compile and run the test case quoted at the bottom of this 
report.

What is the expected output? What do you see instead?

The first assertion should stop the test. You would expect the test to fail 
with "Assertion failed: false should be true", but the test will fail with 
"Timeout: expected event was not dispatched" instead.

What version of the product are you using? On what operating system?

I am using Fluint 1.1.1

Please provide any additional information below.

[Test]
public function testAsync():void {
    var dispatcher:IEventDispatcher = new EventDispatcher();

    // Asynchronous test: expect an event to be dispatched
    dispatcher.addEventListener("someEvent",
        asyncHandler(pendUntilComplete, 100), false, 0, true);

    // This will fail the test
    assertTrue(false);

    // Do something that will throw the expected event
    dispatcher.dispatchEvent(new Event("someEvent"));
}

The reason for the test failing with "Timeout: expected event was not 
dispatched" is because although the test already failed, it still continues 
to wait for the asynchronous expectation.

Fluint only stores one error message per test case, and the timeout message 
overrides the message from the assertion that the test initially failed 
with. This overriding of the message hides the real reason why the test 
failed, and is therefore undesired behaviour in my opinion.

Attached to this report is a patch with a fix for this issue. The patch 
cancels any asynchronous expectations when the test method throws an 
exception.

Original issue reported on code.google.com by amfr...@gmail.com on 28 Jul 2009 at 6:58

Attachments:

GoogleCodeExporter commented 8 years ago
OMG!  Is this truly a bug?!  Is this really the way fluint works?  I've spent 
the last week trying to figure out what is really going wrong in my unit tests, 
but usually get a timeout error.  It makes debugging fluint almost impossible!!!

Original comment by dtaylor...@gmail.com on 25 Oct 2012 at 6:32

GoogleCodeExporter commented 8 years ago
I just tried this sample TestCase in fluint r269 and it is still doing this 
behavior. This makes debugging where and why a test failed nearly impossible 
when using async.

I see the original post also included a fix back in 2009, and it still hasn't 
been addressed?!  Making me very sad that we are using fluint ;-(

Original comment by dtaylor...@gmail.com on 25 Oct 2012 at 6:58