getting flexunit4 tests to run

I'm not able to run FlexUnit tests inside intellij, I can run the same test from the FlexUnit 4 runner without a problem.

I've got a simple test suite with one async test, that calls a url and parses the rss feed..   However it appears to be compiling in more of the app, because I'm getting these errors which reference the AIR application RPX login widget and NativeWindow.. Which are both used in the App, but not in the test suite.

Adobe fdb (Flash Player Debugger) [build 4852]
Copyright (c) 2004-2007 Adobe, Inc. All rights reserved.
Waiting for Player to connect
Player connected; session starting.
[SWF] Users:mnimer:Development:nomeeJiraSvn:CLIENTS:trunk:clients:desktop:out:production:desktop:desktop-flexunit.swf - 5,310,302 bytes after decompression
[Fault] exception, information=VerifyError: Error #1014: Class flash.events::NativeWindowBoundsEvent could not be found.
[Fault] exception, information=ReferenceError: Error #1065: Variable RPXSignInSprite_myspaceIcon is not defined.
[Fault] exception, information=ReferenceError: Error #1065: Variable WindowMinimizeButtonSkin_macMinDownSkin is not defined.
[Fault] exception, information=ReferenceError: Error #1065: Variable _DragManagerStyle__embed_css_Assets_swf_mx_skins_cursor_DragReject_565140848 is not defined.
[Fault] exception, information=ReferenceError: Error #1065: Variable RPXSignInSprite_facebookLogo is not defined.
[Fault] exception, information=ReferenceError: Error #1065: Variable ShareGroupView_edit is not defined.
[Fault] exception, information=ReferenceError: Error #1065: Variable NomeeApplication_Nomee16NLogo is not defined.

It also appears to be opening the desktop-flexunit.swf in the flash player app (not running the test in intelliJ).. And then after I kill the test in intelliJ, I get this error "Empty test suite."

Is there a config trick I'm missing?



thanks,
--mike

3 comments

Hello Mike,

To run FlexUnit tests IDEA generates MXML launcher file that feeds the selected tests to the FlexUnit runner. Laucher file is set as an entry point of the test application that is built and executed by Flash Player while IDEA listens to the test output and displays the results.

In general, the scope of classes that are included into the applciation is defined by the Flex compiler. Namely, it includes only those classes that are referenced, starting from the application entry point. Is there any chance your tests depend on AIR classes (maybe implicitly)? Can you please show your test code?

Regards,
Kirill

0

Does it put that launcher file anywhere that I can look at and/or modify?

I just did a little more testing. If I run a very simple Assert.assertEquals(2,2) test it does work.. So I know it is working.. And as soon as I add a reference to my applicationModel (lot's of properties but no UI). I start getting the errors. My ApplicationModel does have references to the AIR framework, however I still have no idea how it got a reference to the login UI component - but I'll blame that on the flex compiler.


Could this be the problem.. The test runner is a <mx:Application> and I'm trying to test code in an AIR app, so I need the test runner to be based on <mx:WindowApplication> instead? If the app uses AIR libraries, couldn't this be automatic? Or always AIR?

0

Hello Mike,

Test application launcher is saved as <temp-dir>/<module-name>_<user-name>____FlexUnitLauncher.mxml. Unfortunately, it is re-generated on every test run so there is no sence to change it by hands.

So we have two issues. First is why do AIR classes get compiled into the application. The dependency on AIR might be located by temporarily commenting out some parts of the model then compiling and running the project.

Another issue is that IDEA uses Flash player to execute tests that depend on AIR. I've created a JIRA issue for that: http://www.jetbrains.net/jira/browse/IDEADEV-39485, you may watch it to be notified when it's fixed.

BTW In your first post you mentioned that you've successfully run yours tests "...from the FlexUnit 4 runner". Did you write the laucher file yourself?


Regards,
  Kirill

0

Please sign in to leave a comment.