Exception handling in sequences

1 view
Skip to first unread message

Kristaps Rāts

unread,
Nov 12, 2009, 6:33:52 AM11/12/09
to Fluint Discussions
Hello,
I have a sequence that causes an exception in one step. Fluint doesn't
catch this exception and the test runner stops after it. I assume this
is not the intended behaviour. Do I have to take additional steps to
catch errors when using sequences?

I'm using the fluint 1.1.1 binary available from the project download
page and Flex SDK 3.3.0.4852.

Michael Labriola

unread,
Nov 12, 2009, 9:40:41 AM11/12/09
to Fluint Discussions
When you say fluint doesn't catch it, do you mean it doesn't notice
the error... can you provide more detail and an example so we can
debug?

Kristaps Rāts

unread,
Nov 13, 2009, 3:08:16 AM11/13/09
to Fluint Discussions
Turns out the problem is triggered by my components updateDisplayList
(). I don't know if fluint is supposed to catch errors during a
components validation phase, but this would be the testcase:

// Component
package ns
{
import mx.core.UIComponent;

public class TestComponent extends UIComponent
{
public var _goBoom:Boolean = false;

public function trigger():void
{
_goBoom = true;
invalidateDisplayList();
}

override protected function updateDisplayList(w:Number,
h:Number):void
{
super.updateDisplayList(w, h);
if (_goBoom)
{
_goBoom = false;
var nullObj:Object = null;
nullObj.number = 42; // This is caught by flex builder, not by
fluint
}
}
}
}


// Testcase
package ns
{
import mx.events.FlexEvent;

import net.digitalprimates.fluint.sequence.SequenceCaller;
import net.digitalprimates.fluint.sequence.SequenceRunner;
import net.digitalprimates.fluint.sequence.SequenceWaiter;
import net.digitalprimates.fluint.tests.TestCase;

public class SeqTestCase extends TestCase
{
public var comp:TestComponent;
public var seq:SequenceRunner;

override protected function setUp():void
{
super.setUp();
comp = new TestComponent();

seq = new SequenceRunner(this);
seq.addStep(new SequenceWaiter(comp, FlexEvent.CREATION_COMPLETE,
1000));
seq.addStep(new SequenceCaller(comp, comp.trigger));
}

public function testBoom():void
{
addChild(comp);
seq.run();
}

public function testFail():void
{
fail() // not executed, since the test runner stops after executing
testBoom

Michael Labriola

unread,
Nov 13, 2009, 8:51:29 AM11/13/09
to Fluint Discussions
Thanks for the excellent testcase. I will review but this one is very
difficult. Lack of global error handling in the player here doesn't
help butsince the the error is caused during an invalidation phase
when the call stack is outside of fluint I am not sure if we can do
much
Reply all
Reply to author
Forward
0 new messages