|
From: Robert S. <rob...@gm...> - 2007-04-08 16:42:49
|
Thanks for the response. I found the yahoo example in the comm folder of the AsUnit repository, and figured it out from there. Is there currently a way to keep from having to explictly reference all the test methods as in NUnit or JUnit? Though that probably uses reflection, and I am not sure AS3 supports anything like that or not. I will try to post a tutorial on how to use AsUnit with AS3 sometime soon. I will CC this list so y'all can correct me if I'm wrong about something. As far as usage goes, I am planning to simply have two projects, one that uses my library and another that tests it. Speaking of testing, are y'all aware of anything that will let you do functional testing on Flash Apps. That would be a huge selling point with my boss. I am uncertain as how to use the TestSuite class. Does that work like test suites in JSUnit were you can just load multiple runners and have them execute at once? If so, could someone point me to an example? Thanks again for your help, Robert On 4/6/07, Luke Bayes <lb...@gm...> wrote: > > I'm not sure why you're getting that particular error, but you should be > running your test cases from a TestRunner, not just instantiating them > directly. > > Essentially, you want two application roots, one that is your deployed > application, and the other that extends asunit.textui.TestRunner and > calls: > > start(TestCaseOrTestSuite:Class, [methodName:String, > traceOutput:Boolean]); > > Then you want MXMLC to switch between the the deployed application root or > your concrete TestRunner depending on what you're doing at the moment. > > You should know that if you pass a methodName to the start method, the > base TestCase will call setUp, then the method and stop. This gives you the > ability to attach visual assets to the stage (using TestCase.addChild(child:DisplayObject)), and actually see them... > > > Please let us know if that doesn't solve the problem. > > > Thanks, > > > Luke Bayes > www.asunit.org > > On 3/31/07, Robert Stackhouse <rob...@gm...> wrote: > > > Has anyone else had this problem? > > > > C:\SVN\AgCg\ActionScript3\Projects\ASUnitDemo\tests\ExampleTest.as(4): > > col: 35 Error: The definition of base class TestCase was not found. > > > > I am using FlashDevelop and Ant, but I know neither is my problem as I > > tried to compile by hand: > > > > C:\SVN\AgCg\ActionScript3\Projects\ASUnitDemo>mxmlc -sp="C:/Program > > Files/AsUnit/framework/as3/asunit" > > -sp=C:/SVN/AgCg/ActionScript3/Projects/ASUnitDemo/tests > > -default-frame-rate=24 -default-background-color=0xFFFFFF -default-size > > 550 400 -o=C:/SVN/AgCg/ActionScript3/Projects/ASUnitDemo/deploy/App.swf -- > > C:/SVN/AgCg/ActionScript3/Projects/ASUnitDemo/src/App.as > > > > My directory structure is as follows: > > > > ASUnitDemo/ > > -src/ > > --App.as <http://app.as/> > > -- Example.as <http://example.as/> > > -tests/ > > --AllTests.as > > --ExampleTest.as > > > > The contents of the relevant files are as follows: > > > > App.as <http://app.as/> > > package > > { > > import flash.display.Sprite; > > import flash.display.StageAlign; > > import flash.display.StageScaleMode; > > import ExampleTest; > > > > public class App extends Sprite > > { > > public function App() > > { > > init(); > > } > > > > private function init():void > > { > > stage.scaleMode = StageScaleMode.NO_SCALE; > > stage.align=StageAlign.TOP_LEFT; > > var tests:ExampleTest = new ExampleTest(); > > } > > } > > } > > > > Example.as <http://example.as/> > > package { > > > > public class Example { > > > > public function Example() { > > } > > } > > } > > > > AllTests.as > > package { > > import asunit.framework.TestSuite; > > import ExampleTest; > > > > public class AllTests extends asunit.framework.TestSuite{ > > > > public function AllTests() { > > addTest(new ExampleTest()); > > } > > } > > } > > > > ExampleTest.as > > package { > > import asunit.framework.TestCase; > > > > public class ExampleTest extends TestCase { > > private var instance:Example; > > > > public function ExampleTest(testMethod:String = null) { > > super(testMethod); > > } > > > > protected override function setUp():void { > > instance = new Example(); > > } > > > > protected override function tearDown():void { > > instance = null; > > } > > > > public function testInstantiated():void { > > assertTrue("Example instantiated", instance is Example); > > } > > > > public function test():void { > > assertTrue("failing test", false); > > } > > } > > } > > > > Thanks in advance for any help! > > > > Robert > > > > > > > > > > > > ------------------------------------------------------------------------- > > Take Surveys. Earn Cash. Influence the Future of IT > > Join SourceForge.net's Techsay panel and you'll get the chance to share > > your > > opinions on IT & business topics through brief surveys-and earn cash > > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > _______________________________________________ > > Asunit-users mailing list > > Asu...@li... > > https://lists.sourceforge.net/lists/listinfo/asunit-users > > > > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Asunit-users mailing list > Asu...@li... > https://lists.sourceforge.net/lists/listinfo/asunit-users > > |