asunit icon indicating copy to clipboard operation
asunit copied to clipboard

Reference Error when addAsync() called from within setUp()

Open lanferna opened this issue 15 years ago • 2 comments

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?

lanferna avatar May 26 '10 01:05 lanferna

Which version of AsUnit are you using? Can you show more of your TestCase code?

robertpenner avatar May 26 '10 01:05 robertpenner

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 {}

}

lanferna avatar May 26 '10 02:05 lanferna