apache-flexflexunitflexunit4

How to use SequenceRunner with FlexUnit 4


In the FlexUnit wiki I've read about the very interesting SequenceRunner that was contributed by the Fluint folks. Now I am trying to run a test that is very similar to the example, however when executing the run() Method of the SequenceRunner instance, I get this exception:

    Cannot add asynchronous functionality to methods defined by Test,Before or After that are not marked async
Error: Cannot add asynchronous functionality to methods defined by Test,Before or After that are not marked async
    at org.flexunit.async::AsyncLocator$/getCallableForTest()[C:\Users\dmoor e\Documents\_Production\Flex Unit 4\GIT\FlexUnit4\src\org\flexunit\async\AsyncLocator.as:82]
    at org.fluint.sequence::SequenceWaiter/setupListeners()[C:\Users\dmoore\ Documents\_Production\Flex Unit 4\GIT\FlexUnit4\src\org\fluint\sequence\SequenceWaiter.as:100]
    at org.fluint.sequence::SequenceRunner/continueSequence()[C:\Users\dmoor e\Documents\_Production\Flex Unit 4\GIT\FlexUnit4\src\org\fluint\sequence\SequenceRunner.as:177]
    at org.fluint.sequence::SequenceRunner/run()[C:\Users\dmoore\Documents\_ Production\Flex Unit 4\GIT\FlexUnit4\src\org\fluint\sequence\SequenceRunner.as:124]

Has anyone used the SequenceRunner with FlexUnit 4 already. The [Test(async)] annotation is already present.


Solution

  • Thanks to Michael Labriola, who responded to my question in the Adobe Forum I was finally able to make it running. Note that the documentation of SequenceRunner in the Wiki is outdated and partially wrong.

    1. Do not inherit from any TestCase class.
    2. Skip the asyncHandler for CREATION_COMPLETE in the setUp. Rather add a SequenceWaiter in the test that waits for the CREATION_COMPLETE event of the component
    3. The test must be marked as asynchronous test, so add the [Test(async)] Metadata to test cases that use SequenceRunner.