|
From: Luke B. <lb...@gm...> - 2007-04-06 20:41:11
|
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 > --Example.as > -tests/ > --AllTests.as > --ExampleTest.as > > The contents of the relevant files are as follows: > > 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 > 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 > > |