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!

Thursday, November 13, 2008

Flash Selenium: zZzZZzz, drool....

When we kicked off Flash Selenium, Firefox 2 and IE7 were the only browser(s) that we intended to support. But, the world moved on and most likely we did not. The scene was something of this sort:

Then-
Microsoft: IE 7 is awesome. We rule your world!
Mozilla: Firefox 2 is kick-ass. We'll take over the world with FF2.
Selenium: Oh yeah, these two are here to stay. I'm cool with both of them.
Flash Selenium: Thank god Selenium's got my back.

Now-
Microsoft: IE 8 is better than ever. Lotta ppl agree to this.
Mozilla: To hell with Firefox 2. We'll give out Firefox 3. A better, improved, cutting-edge browser full of c**p! We'll make hell lotta changes to the way things used to work with FF2 and how it'll work with FF3. You damn right we will, coz WE CAN!
Selenium: I'll patch myself to make things work for now. Man these two guys are driving me nuts!
Flash Selenium: zZzZZzz, drool....

So now you see, we thought that we had the most generic solution that was transparent to the outside world and could be used to test even Einstein's Theory Of Relativity, but boy were we wrong! Firefox 3 made some changes to the way Javascript functions were invoked as compared to Firefox 2 and it's only when the issue was logged that we snapped out of our dream and came crashing down to reality.

FF2 used the document. notation while FF3 will use window.document. notation to refer to a document object. I still don't know why Mozilla ended up making this change but Flash Selenium went in for a toss.

The good news is that Revision 25 has the fix for Java and .NET Client of Flash Selenium and we'll fix the rest in few days.

PS: We appreciate the issues that have been logged by our users. Thanks a lot.