Skip to main content
August 30, 2011
Question

Testing Application Components

  • August 30, 2011
  • 1 reply
  • 2227 views

I'm not sure if you are aware, but it is currently very difficult to test spark Application components using FlexUnit and the UIImpersonator. An application component can't simply be added to UIImpersonator with addChild; there is already an existing Application for the test environment. What you have to do instead is create and add a SWFLoader and then use that to load an instance of the Application to test. The workaround is not very difficult, but having a mention of this issue in the documentation somewhere would have been helpful. Better yet perhaps add a function to UIImpersonator that takes care of the extra steps involved in testing an Application. What do you think?

This topic has been closed for replies.

1 reply

Participating Frequently
August 30, 2011

Which version of FlexUnit are you using?

As of 4.1 we allowed the interface to have an addElement() which accepts spark components just like the Spark Application?

Mike

August 30, 2011

I might be running an older version since we're still using flashbuilder 4. Is there any way to update the flexunit libraries that flashbuilder uses?

Participating Frequently
August 30, 2011

Its a little convoluted in Flash Builder 4, so what I would suggest first instead is that you just add the FlexUnit 4.1 swc to your library path of your test project. It should trump the existing version and let you test with 4.1 before you have to hunt down the existing swc, etc.

Mike