Friday, September 11, 2009

Mock samples for AS3

I have uploaded the mock samples for AS3 (FlexUnit and mock4as1.0) at the MockSampels project.

The samples are concise and illustrative examples of Mock Objects features, such as exceptions, consecutive calls, and time-based testing.

Bellow are some snapshots of the test code.

sample code from the BankSysteTest



accountFrom.expects("withdraw").withArg(20.0).willThrow(new InsufficientFundsException());
try{
bank.transfer(accountFrom, accountTo, 20.0);
}catch (e:InsufficientFundsException){
assertNotNull(e);
}
accountFrom.verify();

sample code rom the TimedCacheTest



cache = new TimedCache(objectLoader, clock, reloadPolicy);
objectLoader.expects("load").times(1).withArg(KEY).willReturn(VALUE);
assertEquals(VALUE, cache.lookUp(KEY));
objectLoader.verify();



3 comments:

Aditya said...

Hey,
I am trying to use selenium 1.0 with flex 3.0 on Firefox 3.x.

I placed the selenium.swc in lib folder & compiled one of my mxml. Final output(swf) is placed in web application, also included user-extension.js in IDE & started to walk through with selenium IDE in firefox 3.x. But the events are not recorded.

Can you please help me out & its great if you help me out with an sample applciation.... (veladitya@gmail.com)

Thx alot.

Automation Testing Institute said...

Flash Selenium has been named a finalist in this year's ATI Automation Honors. For more information, visit http://www.atihonors.automatedtestinginstitute.com.

Author said...

Learn adobe flash,actionscript, as3, html5, flex tutorials

adobe flash,actionscript, as3, html5, flex