Quantcast
Channel: Adobe Community : Popular Discussions - FlexUnit
Viewing all articles
Browse latest Browse all 25673

how to access stage in flexunit

$
0
0

I've found in the following post (http://forums.adobe.com/message/2371850#2371850) some suggestions about this topic, but as I'm relatively new to as3, I'm still confused about how to make it work. My team has an as3 only project, and we refer to the stage very often this way:

 

package clipper{

     ...

     public function init() {

          onInit();

          ...

     }

 

     private function onInit() {

          this.stage.frameRate = 24;

          this.stage.addChild(...);

          ...

     }

}

 

Everytime when my testcases call statements like this, it'll give error saying "null object reference", etc. As far as I've read in the other post, I should initiate a VisualTestEnvironment in the test runner, and use the UIImpersonator in the test cases, am I right? If I wanna write a testcase for function init as below, how shall I modify the codes? What shall I add in the mxml test runner? Thanks. I'm building and running the tests with ant.

 

var _clip:clipper;

 

[Before]

public function setUp():void {

     _clip = new clipper();

     UIImpersonator.addChild(_clip);

}

 

[Test(async)]

public function testInit():void{

     _clip.init();

     assert...

}


Viewing all articles
Browse latest Browse all 25673

Trending Articles