Reference Error when addAsync() called from within setUp()
I'm trying to integrate ASMock with AsUnit. Here is the folowing code in setUp() method: repository = new MockRepository(); var prepareDispatcher:IEventDispatcher = _repository.prepare([MovieClip]); prepareDispatcher.addEventListener(Event.COMPLETE, addAsync());
If there is only one test method in test case - everything's going right. If there are 2 or more, ReferenceError occurs at line "thismethodName;" in runMethod() in TestCase (methodName is null). Am I doing wrong?
Which version of AsUnit are you using? Can you show more of your TestCase code?
version 4.0.3
Here is about simplest test case construction producing the error:
public class JustTest extends TestCase
{
public function JustTest(testMethod:String)
{ super(testMethod); }
private var _repository:MockRepository;
private var _clip:MovieClip;
override protected function setUp() : void
{
_repository = new MockRepository();
var prepareDispatcher:IEventDispatcher = _repository.prepare([MovieClip]);
prepareDispatcher.addEventListener(Event.COMPLETE, addAsync());
}
override protected function tearDown() : void
{
_repository = null;
_clip = null;
}
public function test_0() : void {}
public function test_2() : void {}
}