|
From: Marcelo de M. S. <cel...@gm...> - 2006-12-25 22:08:19
|
Hi,
I'm just starting with unit testing, so, sorry if my questions sound stupid
or something alike.
I have a Preloader class which is a simple MovieClip subclass that gets
compiled into Preloader.swf. This Preloader only uses native Flash Player
resouces (i.e: no additional as2 classes). It has a very simple execution
flow, but I'd like to test it (try to load the other swf, does the code that
loads the swf work? Are all the MovieClipLoader's callbacks being called?
The data sent from swfobject is there?) . However, I'm confused on how I
would go on testing this class as it's a MovieClip subclass.
So, I have the PreloaderTest class:
import asunit.framework.TestCase;
class testes.PreloaderTest extends TestCase
{
private var _PreloaderClip:MovieClip;
public function PreloaderTest(testMethod:String)
{
super(testMethod);
}
public function setUp():Void
{
//Here, I tried creating an empty MovieClip to the root of the test
swf...
_PreloaderClip =
_root.createEmptyMovieClip("preloader_clip",_root.getNextHightestDepth());
//But then I realized that this MovieClip needed to be registered to
the correspondent Preloader class! ... too much of a hassle... As this clip
isn't on the library (it has been
//created) I would need to do dirty prototype tricks to get the class
registered. I know it's not that difficult (although I can't remember how to
do it) but I felt that it isn't the way
//to go for testing. SHould I just create an instance of the Preloader
class using the new notation?
}
public function tearDown():Void
{
}
}
I'm really confused... Maybe I shouldn't be testing this class. Maybe I
should rethink the design and make it more "test-friendly", but how?.
Any help would be greatly appreciated!
Thanks in advance,
Marcelo.
|