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. To be compatible with Flex3, I think Application.Application can simply be used instead of FlexGlobals.topLevelApplication 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] For more options, visit this group at http://groups.google.com/group/flex-mojos http://flexmojos.sonatype.org/
