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();



Sunday, July 12, 2009

FlashSelenium java client v1.0 released

FlashSelenium java client is now compatibility with Selenium RC 1.0.

A few problems were reported for FlashSelenium when used with the newest version of Selenium RC, SRC version 1.0.

The issues were mainly related on how FlashSelenium and Selenium RC were dealing with the object id for the Flash object.

A fix has been updated for the FlashSelenium java client. The other FlashSelenium clients are being fixed shortly.

Sunday, May 17, 2009

FlexUISelenium for testing Flex UI with Selenium

Due to the high number of requests for making FlashSelenium directly test the UI components of a Flex application, I got involved in a new open source project: flex-ui-selenium. The new component, FlexUISelenium, is used with Selenium RC for testing Flex UI interactions.

FlexUISelenium is an extension to the Selenium RC client driver that enables the Selenium RC client drivers to interact (and test) the Flex UI components and methods of the Flex application.

Here is a sample test code using FlexUISelenium:


@Test
public void sumForValidNumbers() {
flexUITester.type("2").at("arg1");
flexUITester.type("3").at("arg2");
flexUITester.click("submit");
assertEquals("5", flexUITester.readFrom("result"));
}


FlexUISelenium uses Selenium RC, Flash Selenium and Selenium Flex API. FlexUISelenium uses FlashSelenium for enabling the communication of Selenium RC client with the Flash application (swf). And Selenium Flex API exposes all the UI components of the Flex application which are built with SeleniumFlexAPI.swc.

The first public release has just been uploaded to the project page.

Enjoy it!

Tuesday, April 7, 2009

Excellent blog on mock4as

I just read an excellent blog by Pete Hodgson about the latest addtions to mock4as. Here's the link
mock.willExecute(...) in mock4as.

Saturday, February 14, 2009

Happy Birthday Flash-Selenium! Yay!

It is a proud moment for everyone working on Flash-Selenium. It turned "1 year old" this week. With more than 10000+ visits from 87 countries, 1300+ downloads, it sure has grown over time. On this occasion, I like to thank everyone who have contributed to it through their suggestions, bug reporting, ideas and feedback.

Saturday, January 10, 2009

Silverlight Testing with Selenium RC - Silver(rrr)nium

Although unrelated to "this" blog in particular, we now have the RC client(s) to test Silverlight applications using Selenium RC. The project is hosted here and currently has the Java and .NET clients in the "Downloads" section.

Kudos to Sai and Geetan who helped us in understanding Silverlight internals and verifying the client(s) against their prototype. Great job guys!