Sorry to keep jumping around on this. I made some additional changes. I dumped FU4 and pulled in Fluint 1.1.1 instead. Still using asmock with the supposed Fluint support:
http://sourceforge.net/apps/mediawiki/asmock/index.php?title=Installation#fluint I wrote a simple test case almost exactly like that. I'm using MVP pattern. The view is MXML that implements an AS3 interface which is what I'm trying to mock out. The method I'm testing does nothing interesting -- I'm just trying to get the infrastructure in place to write more interesting tests -- it looks like this: public function getData():String { var searchCriteria = view.searchCriteria; return searchCriteria; } The test case looks like this: package tracer { import asmock.framework.MockRepository; import asmock.framework.SetupResult; import asmock.integration.fluint.ASMockTestCase; public class TracerPresenterTest extends ASMockTestCase { private var mockRepository : MockRepository = new MockRepository(); // class under test private var presenter:TracerPresenter; private var view:ITracer; public function TracerPresenterTest() { super([ITracer]); } [Test] public function testGetData():void { // Record view = ITracer(mockRepository.createStub(ITracer)); SetupResult.forCall(view.searchCriteria).returnValue("abc"); mockRepository.replay(view); var result = presenter.getData(); assertEquals( result, "abc" ); } } } This generates the following AS3 argument error about argument mismatch -- I'm stuck here...any ideas? ArgumentError: Error #1063: Argument count mismatch on net.digitalprimates.fluint.ui::TestRunner(). Expected 0, got 1. at org.sonatype.flexmojos.unitestingsupport.fluint::FluintListener/runTests()[/home/nexus/flexmojos/3.x/target/checkout/flexmojos-testing/flexmojos-unittest-fluint/src/main/flex/org/sonatype/flexmojos/unitestingsupport/fluint/FluintListener.as:54] at org.sonatype.flexmojos.unitestingsupport.fluint::FluintListener/run()[/home/nexus/flexmojos/3.x/target/checkout/flexmojos-testing/flexmojos-unittest-fluint/src/main/flex/org/sonatype/flexmojos/unitestingsupport/fluint/FluintListener.as:49] at org.sonatype.flexmojos.unitestingsupport::SocketReporter/runTests()[/home/nexus/flexmojos/3.x/target/checkout/flexmojos-testing/flexmojos-unittest-support/src/main/flex/org/sonatype/flexmojos/unitestingsupport/SocketReporter.as:243] at org.sonatype.flexmojos.unitestingsupport::TestApplication/runTests()[/home/nexus/flexmojos/3.x/target/checkout/flexmojos-testing/flexmojos-unittest-support/src/main/flex/org/sonatype/flexmojos/unitestingsupport/TestApplication.as:40] at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.core::UIComponent/dispatchEvent()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\UIComponent.as:9408] at mx.core::UIComponent/set initialized()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\UIComponent.as:1169] at mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\managers\LayoutManager.as:718] at Function/http://adobe.com/AS3/2006/builtin::apply() at mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\UIComponent.as:8733] at mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\UIComponent.as:8673] On Wed, Dec 16, 2009 at 11:03 AM, velo <[email protected]> wrote: > W8, you don't need to declare that include... try w/o it. > > VELO > > On Dec 16, 1:59 pm, Davis Ford <[email protected]> wrote: > > I didn't have the deps inside the plugin configuration originally and > then I > > tried that after it couldn't resolve the include. > > > > > > > > On Wed, Dec 16, 2009 at 10:45 AM, velo <[email protected]> wrote: > > > Hrmmm, maven usage issue... > > > > > When you need to add a new dependency to your project, where should > > > you add it? I quite sure it is not on flexmojos =D > > > > > So move this dependencies and try again. > > > > > VELO > > > > > On Dec 16, 1:39 pm, Davis Ford <[email protected]> wrote: > > > > Hi, I'm trying to setup the flexunit4 asmock test runner. The guide > is > > > > here: > > > > > > > http://sourceforge.net/apps/mediawiki/asmock/index.php?title=Installa... > > > > > > So, my test case starts like this: > > > > > > [RunWith("asmock.integration.flexunit.ASMockClassRunner")] > > > > [Mock("tracer.IView")] > > > > public class TracerPresenterTest > > > > { > > > > .... > > > > > > My flexmojos configuration is pasted below. I added an explicit > > > dependency > > > > on the asmock swc's and I added an <import> for the class, but when I > run > > > > the test I get: > > > > > > [ERROR] Unable to resolve a class for include: > > > > asmock.integration.flexunit:ASMockClassRunner. > > > > > > Any ideas? > > > > > > Regards, > > > > Davis > > > > > > <plugin> > > > > <groupId>org.sonatype.flexmojos</groupId> > > > > <artifactId>flexmojos-maven-plugin</artifactId> > > > > <dependencies> > > > > <dependency> > > > > <groupId>com.adobe.flex</groupId> > > > > <artifactId>compiler</artifactId> > > > > <version>3.4.0.9271</version> > > > > <type>pom</type> > > > > </dependency> > > > > <dependency> > > > > <groupId>net.sf.asmock</groupId> > > > > <artifactId>asmock</artifactId> > > > > <version>0.9</version> > > > > <type>swc</type> > > > > <scope>test</scope> > > > > </dependency> > > > > <dependency> > > > > <groupId>net.sf.asmock</groupId> > > > > <artifactId>asmock-flexunit4</artifactId> > > > > <version>0.9</version> > > > > <type>swc</type> > > > > <scope>test</scope> > > > > </dependency> > > > > </dependencies> > > > > <version>${flex.version}</version> > > > > <extensions>true</extensions> > > > > <configuration> > > > > <locales> > > > > <locale>en_US</locale> > > > > </locales> > > > > <debug>true</debug> > > > > <configurationReport>true</configurationReport> > > > > <includes> > > > > <include>asmock.integration.flexunit.ASMockClassRunner</include> > > > > </includes> > > > > </configuration> > > > > </plugin> > > > > > -- > > > 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]> > <flex-mojos%[email protected]<flex-mojos%[email protected]> > > > > > For more options, visit this group at > > >http://groups.google.com/group/flex-mojos?hl=en?hl=en > > > > >http://blog.flex-mojos.info/ > > > > -- > > Zeno Consulting, Inc. > > home:http://www.zenoconsulting.biz > > blog:http://zenoconsulting.wikidot.com > > p: 248.894.4922 > > f: 313.884.2977 > > -- > 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?hl=en?hl=en > > http://blog.flex-mojos.info/ > -- Zeno Consulting, Inc. home: http://www.zenoconsulting.biz blog: http://zenoconsulting.wikidot.com p: 248.894.4922 f: 313.884.2977 -- 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?hl=en?hl=en http://blog.flex-mojos.info/
