I was running into a problem when trying to run some kind of unit
tests which need to component under test to be actually added to the
stage in order for the test to succeed.  The tests would pass with my
FluintTestRunner.mxml, but not when run through flexmojos (3.7.1).

The solution I found is to modify FluintListener.as as follows:

...
        public function runTests():int
        {
            var testRunner:TestRunner=new TestRunner(_testMonitor);
            testRunner.testEnvironment = new TestEnvironment();
+           // Add testEnvironment to Application, to be able to test
graphical components
+           var app:Application = FlexGlobals.topLevelApplication as
Application;
+           app.addChild(testRunner.testEnvironment);
            testRunner.startTests(_testSuite);
            testRunner.addEventListener(TestRunner.TESTS_COMPLETE,
handleTestsComplete);
            return testRunner.getTestCount();
        }
...

As described in fluint ASDoc, "the TestEnvironment is a singleton
class that allows tests to have visual components. The TestCase has a
series of fascade methods such as addChild() and removeChild() which
actually call those methods on this class."

However, the TestEnvironment cannot play its role if it is not added
to the Application, as above.

I hope that this fix can be included in a future release of flexmojos.

(I should better have filed a JIRA issue, but I am not sure how to
specify all the details...)

-- 
You received this message because you are subscribed to the Google
Groups "Flex Mojos" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/flex-mojos

http://flexmojos.sonatype.org/

Reply via email to