Copy link to clipboard
Copied
Hi there-
I've been using the UIImpersonator in FlexUnit (for AS, not Flex) to unit test certain components that need to be added to the stage to function correctly. To do so, one must initialize the FlexUnitCore.visualDisplayRoot with the stage, which I do when I hand craft the test runner in my own source code.
In FlashBuilder, the test program runner is auto generated by the builder and it uses something called flexunit.flexui.FlexUnitTestRunnerUIAS, for which I cannot find any documentation or source code in the FlexUnit depot. I suspect this is some Flash Builder custom file? In any event, it appears to add itself to the stage, but it seems to not be internally initializing the UIImpersonator correctly. Any DisplayObjects that are added to the UIImpersonator are *not* on the stage.
Has anyone investigated how to make this work correctly? Seems like a bug.
Richard
Copy link to clipboard
Copied
Hi,
You are right, Flash Builder creates a wrapper around FlexUnit runner class to generate FlexUnitApplication.as and then runs the required tests.
Also, this API is not exposed.
Does it work with Flex projects?
Is your requirement to customize the same and add your custom logic?
If yes, you could extend FB generated FlexUnitApplication and create your application with the logic you would want and configure the same in Window->Preference->Flash Builder->FlexUnit->Custom Application name.
Let us know if it helps.
Thanks,
Balaji
http://balajisridhar.wordpress.com
Copy link to clipboard
Copied
I am not using Flex, so unsure if it works there.
I found the source code for FlexUnitTestRunnerUIAS.as in my .eclipse configuration directory (FlexBuilder must have installed it there, which was nice). I patched the file to properly configure the UIImpersonator and rebuild the flexunitextendedAS.swc used by FlashBuilder's FlexUnit wrapper. Put it back into my .eclipse configuration directory and all was better.
It would be nice if adobe fixed this in their next release so I don't need to patch the file again.
Richard