Have you looked at using Flexunit 4? I think it folded in Fluint and supersedes 
that project, correct? FU4 does provide asynchronous and Ui testing via maven

Sent from my iPhone

On Jul 14, 2010, at 10:07 AM, Antoine <[email protected]> wrote:

> Yes, I just tested it on Flex4 now.  It does issue a warning, but I
> can live with it.
> 
> Note I made a little spelling mistake: it should be
> Application.application instead of Application.Application.
> Here is the patched piece of code working with both Flex3 and Flex4:
> 
> ...
>        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 = Application.application as
> Application;
> +           app.addChild(testRunner.testEnvironment);
>            testRunner.startTests(_testSuite);
>            testRunner.addEventListener(TestRunner.TESTS_COMPLETE,
> handleTestsComplete);
>            return testRunner.getTestCount();
>        }
> ...
> 
> Thanks.
> 
> On Jul 14, 11:16 pm, Marvin Froeder <[email protected]> wrote:
>> On Wed, Jul 14, 2010 at 11:08 AM, Antoine <[email protected]> wrote:
>>> Thank you for your answer, Velo.
>> 
>>> By "visual tests", I don't mean that something would be displayed, but
>>> just that graphic components are added to the stage.
>>> I want to test view state logic of some of my graphic components, but
>>> if the graphic component under test is not added to the stage, it will
>>> not receive view state change events (at least not anymore in Flex4).
>>> Besides, when you look at the default fluint test runner, it looks
>>> like this:
>> 
>>> <?xml version="1.0" encoding="utf-8"?>
>>> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
>>> xmlns:fluint="http://www.digitalprimates.net/2008/fluint";>
>>>    ...
>>>    <fluint:TestEnvironment id="testEnvironment"/>
>>>    <fluint:TestRunner id="testRunner"
>>> testEnvironment="{testEnvironment}"/>
>>> </mx:Application>
>> 
>>> You see that the TestEnvironment is child of Application.
>> 
>>> I tried to use a custom TestRunner template, without success because
>>> the TestEnvironment is created in the FluintTestListener.as so it
>>> cannot be put in my template.
>>> Something could be possible if the TestEnvironment was made accessible
>>> through a public method.
>> 
>> Well, I guess I can apply your original patch... if it works with Flex 3 and
>> 4 w/o changes.
>> 
>> 
>> 
>>> To be compatible with Flex3, I think Application.Application can
>>> simply be used instead of FlexGlobals.topLevelApplication
>> 
>> Does that work on Flex 4?
>> 
>> VELO
>> 
>> 
>> 
>>> On Jul 14, 8:51 am, velo <[email protected]> wrote:
>>>> File a jira for it.... but I don't know how I feel about that....
>>>> flexmojos default test runner was never meant to run visual tests...
>>>> it is kinda design flaw...  Also they need to be compatible with
>>>> Flex3.... any thoughts on that?
>> 
>>>> You could also use a custom test runner or even put that on your test
>>>> class.... just some random ideas...
>> 
>>>> On Jul 11, 8:53 am, Antoine <[email protected]> wrote:
>> 
>>>>> 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]<flex-mojos%[email protected]>
>>> For more options, visit this group at
>>> http://groups.google.com/group/flex-mojos
>> 
>>> http://flexmojos.sonatype.org/
>> 
>> 
> 
> -- 
> 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/

-- 
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