Does IntelliJ package own version of flexunit?

This is follow up to http://devnet.jetbrains.com/message/5507979#5507979

I see discrepency in the way unit tests work when run from inside IntelliJ vs. when I run them from command line. Most obvious one, when running tests via IntelliJ, I am getting this exception unless my test classes extends TestCase:

Error #1009: Cannot access a property or method of a null object reference.
TypeError: Error #1009: Cannot access a property or method of a null object reference.
     at org.fluint.uiImpersonation.flex::FlexEnvironmentBuilder/buildVisualTestEnvironment()[xxxxxx/3rdparty/ApacheFunit/flex-flexunit/FlexUnit4/src/org/fluint/uiImpersonation/flex/FlexEnvironmentBuilder.as:85]
     at org.fluint.uiImpersonation::VisualTestEnvironmentBuilder/buildVisualTestEnvironment()[xxxxxx/3rdparty/ApacheFunit/flex-flexunit/FlexUnit4/src/org/fluint/uiImpersonation/VisualTestEnvironmentBuilder.as:75]
     at org.flexunit.internals.runners.watcher::FrameWatcher/getStage()[xxxxxx/3rdparty/ApacheFunit/flex-flexunit/FlexUnit4/src/org/flexunit/internals/runners/watcher/FrameWatcher.as:106]
     at org.flexunit.internals.runners.watcher::FrameWatcher()[xxxxxx/3rdparty/ApacheFunit/flex-flexunit/FlexUnit4/src/org/flexunit/internals/runners/watcher/FrameWatcher.as:118]
     at org.flexunit.internals.runners.statements::StackAndFrameManagement()[xxxxxx/3rdparty/ApacheFunit/flex-flexunit/FlexUnit4/src/org/flexunit/internals/runners/statements/StackAndFrameManagement.as:92]
     at org.flexunit.runners::BlockFlexUnit4ClassRunner/withStackManagement()[xxxxxx/3rdparty/ApacheFunit/flex-flexunit/FlexUnit4/src/org/flexunit/runners/BlockFlexUnit4ClassRunner.as:429]
     at org.flexunit.runners::BlockFlexUnit4ClassRunner/withDecoration()[xxxxxx/3rdparty/ApacheFunit/flex-flexunit/FlexUnit4/src/org/flexunit/runners/BlockFlexUnit4ClassRunner.as:382]
     at org.flexunit.runners::BlockFlexUnit4ClassRunner/methodBlock()[xxxxxx/3rdparty/ApacheFunit/flex-flexunit/FlexUnit4/src/org/flexunit/runners/BlockFlexUnit4ClassRunner.as:320]
     at org.flexunit.runners::BlockFlexUnit4ClassRunner/runChild()[xxxxxx/3rdparty/ApacheFunit/flex-flexunit/FlexUnit4/src/org/flexunit/runners/BlockFlexUnit4ClassRunner.as:152]
     at org.flexunit.internals.runners::ChildRunnerSequencer/executeStep()[xxxxxx/3rdparty/ApacheFunit/flex-flexunit/FlexUnit4/src/org/flexunit/internals/runners/ChildRunnerSequencer.as:82]
     at org.flexunit.internals.runners.statements::StatementSequencer/handleChildExecuteComplete()[xxxxxx/3rdparty/ApacheFunit/flex-flexunit/FlexUnit4/src/org/flexunit/internals/runners/statements/StatementSequencer.as:141]
     at org.flexunit.internals.runners.statements::StatementSequencer/evaluate()[xxxxxx/3rdparty/ApacheFunit/flex-flexunit/FlexUnit4/src/org/flexunit/internals/runners/statements/StatementSequencer.as:109]
     at org.flexunit.runners::ParentRunner/run()[xxxxxx/3rdparty/ApacheFunit/flex-flexunit/FlexUnit4/src/org/flexunit/runners/ParentRunner.as:483]
     at org.flexunit.runners::Suite/runChild()[xxxxxx/3rdparty/ApacheFunit/flex-flexunit/FlexUnit4/src/org/flexunit/runners/Suite.as:151]
     at org.flexunit.internals.runners::ChildRunnerSequencer/executeStep()[xxxxxx/3rdparty/ApacheFunit/flex-flexunit/FlexUnit4/src/org/flexunit/internals/runners/ChildRunnerSequencer.as:82]
     at org.flexunit.internals.runners.statements::StatementSequencer/handleChildExecuteComplete()[xxxxxx/3rdparty/ApacheFunit/flex-flexunit/FlexUnit4/src/org/flexunit/internals/runners/statements/StatementSequencer.as:141]
     at org.flexunit.internals.runners.statements::StatementSequencer/evaluate()[xxxxxx/3rdparty/ApacheFunit/flex-flexunit/FlexUnit4/src/org/flexunit/internals/runners/statements/StatementSequencer.as:109]
     at org.flexunit.runners::ParentRunner/run()[xxxxxx/3rdparty/ApacheFunit/flex-flexunit/FlexUnit4/src/org/flexunit/runners/ParentRunner.as:483]
     at org.flexunit.runner::FlexUnitCore/beginRunnerExecution()[xxxxxx/3rdparty/ApacheFunit/flex-flexunit/FlexUnit4/src/org/flexunit/runner/FlexUnitCore.as:348]
     at org.flexunit.runner::FlexUnitCore/runRunner()[xxxxxx/3rdparty/ApacheFunit/flex-flexunit/FlexUnit4/src/org/flexunit/runner/FlexUnitCore.as:307]
     at org.flexunit.runner::FlexUnitCore/runRequest()[xxxxxx/3rdparty/ApacheFunit/flex-flexunit/FlexUnit4/src/org/flexunit/runner/FlexUnitCore.as:283]
     at org.flexunit.runner::FlexUnitCore/runClasses()[xxxxxx/3rdparty/ApacheFunit/flex-flexunit/FlexUnit4/src/org/flexunit/runner/FlexUnitCore.as:269]
     at Function/http://adobe.com/AS3/2006/builtin::apply()
     at org.flexunit.runner::FlexUnitCore/run()[xxxxxx/3rdparty/ApacheFunit/flex-flexunit/FlexUnit4/src/org/flexunit/runner/FlexUnitCore.as:245]
     at com.intellij.flexunit.runner::TestRunner4/runTests()[C:\work\IDEA\flex\tools\flexunit-support\FlexUnit4Runner\src\com\intellij\flexunit\runner\TestRunner4.as:39]
     at com.intellij.flexunit.runner::TestRunnerBase/socketConnected()[C:\work\IDEA\flex\tools\flexunit-support\PureAs\src\com\intellij\flexunit\runner\TestRunnerBase.as:249]


However, when I run it from command line (not using any of IntelliJ artifacts), tests work as expected (mostly).

So it seems that IntelliJ has own version of flexunit? If this is the case, how can I disable it?

Your comments/suggestions will be highly appreciated.

Cheers,
  Andrei

3 comments
Comment actions Permalink

IntelliJ IDEA doesn't have any bundled FlexUnit library, you configure ti yourself at the Dependencies tab of the build configuration. However IDE has its own test runner. Looks like the test runner doesn't perform some initialization that you need to have for your tests. This seems to be related: IDEA-78493

0
Comment actions Permalink

I think you are absolutely correct.  Though to be precise, the root cause of the problem not visualDisplayRoot but flexGlobals.topLevelApplication. This is line which cause the issue (FlexEnvironmentBuilder.as:85):

                        visualDisplayRoot = flexGlobals.topLevelApplication.systemManager;

Unless Test class extends TestCase, flexGlobals.topLevelApplication is null.  

It seems that IDEA-78493 was open for quite a long time... more than 2 years... :(  

Maybe IntelliJ should open source test runner, so community can help fixing it?

I wonder if you will be willing to answer some what "riski" question?

What is JetBrains position on Flex in general (and Apache Flex) in particular? Do you view it as "dead end" technology (and this is why issue stays un-addressed for 2 years :( ).  I got thrown into word of Flex just recently and on one side, some parts of it look much better than I expected (FlexUnit, Mockolate, ...). On other side, it seems that all good development in this area stopped about 2-3 years ago. If you can not answer on behalf of JetBrains, maybe you can post you own priviate thoughts about state of Flex?

Cheers,
  Andrei

0
Comment actions Permalink

Our statistics doesn't show decrease in Flash developers activity. See blog post 1 and blog post 2. This may be caused by people moving from other IDEs to IntelliJ IDEA for Flash development.
I'll answer how to get test runner source code in the YouTrack issue.

0

Please sign in to leave a comment.