Tuesday, December 12, 2006

Reward of Kabini

Call after alarm call signalled the presence of a tiger very close to us. Chitals stood alert with their tails up and ears perked up giving out the loud shrill call. A loud "Cow" - an abrupt shrill call very close to us. A flurry of running dots as the deer bolt. The lantana bushes still cover the tiger from us. We wait patiently and impatiently, wait intently, expectantly. A few minutes pass. A lull. Long laden lull. The deer grow silent. No more alarm calls. The tiger is gone. Not even a glimpse.
The aura of the tiger is no longer felt. Deer go back to their grazing, langurs back to their mischief.

We move on. Disappointed. The night is closing in. We exit the jungle right on time. Our guide Sivanand suggests we try our luck along the road. Our headlights on, we go at a slow pace. A small herd of wild gaur. Huge animals, very close to us. Unperturbed, happily grazing away. One crosses the road in front of us as we wait. Slow, deliberate, unconcerned by our presence. A few metres ahead, a big tusker. Elephants close to your vehicle are not very comforting. A lone male tusker doubly so. We watch, torchlight on the tusks. The elephant leaves us alone.

Alarm calls again. Chital very close. A predator nearby. Experience braces us for disappointment, but optimism still lurks. Sivanand points in the other direction from where we are looking. A smallish stocky animal. Comes out of the cover of the forest. Starts walking on the road. Slightly hurried. Aware of our presence. We move slowly towards it. Our headlights on, but slow enough not to frighten it away. Slow enough to frustrate us to know there is a leopard in front and we cannot see it clearly. Frustrating.

It was a good decision. The leopard moved off the road to the right. We moved in slowly. The pale yellow beam lights the animal's rump as it ambles slowly into the bushes. Then it stops and sits down. In the light of the torch. A female, not too big leopard. The eyes glint reddish in the light as she looks at us for a brief moment. Into the light, into our eyes. Lovely. Brief. She gets up and walks on, away into the bushes, into the darkness, and into the jungle. Back to her comfort zone. And we move on to ours.

Saturday, December 02, 2006

Button tag problems and IE 6

Discovered that IE and Firefox handle the <button> tag differently.

If you have a tag like

< button type="submit" name="b" value="abc">
Button Text< /button>

When the form is submitted, the value of the parameter "b" is "abc" in firefox (the value attribute) while for IE, it is "Button Text" (the innerText)


We needed to submit a form using different buttons and each should send back its respective value.

We used

< input type="submit" name="b" value="Button Text 1">
< input type="hidden" name="Hash_of_Button_Text_1"

< input type="submit" name="b" value="Button Text 2">
< input type="hidden" name="Hash_of_Button_Text_2"

and on the server, accessed it by


where hash("Button Text 1") returns Hash_of_Button_Text_1

Monday, November 27, 2006

Ruby mocking - Using flexstub

Ruby proves to be as sweet as most people have claimed it to be.

Pick testing and and you hit flexmock and flexstub.

So how do you use them? Here goes:

You have

class CA{
def method_1
if condition method_2
else method_3

def method_2

def method_3


If you want to test method_1's conditonal logic, with method_2 and method_3 stubbed out, here is how you do it with flexstub:

require 'flexmock'

class MyTest< Test::Unit::TestCase
include FlexMock::TestCase
def test_method_1
ca = CA.new
# do something to make the condition be true
# stub some methods of the instance
stub = flexstub(ca)
# Note: method_1 is invoked on ca.
# stub.method_1 will fail!

So when would you use flexmock?
If you wish to mock all the methods being called on an object, you may use a flexmock.
A flexmock is an object which will just receive the methods you set expectations for, using should_receive.
If you wish to mock only one of the methods of an object but the other methods need to be invoked with the real functionality,
use flexstub to mock only that particular method.

As you see, method_1 is invoked properly, but method_2 and method_3 are stubbed out.

One remarkable thing about this is mocking out an object's new method.


Anywhere Customer.new is called inside any class during your test, it will return a mock_customer.
This is quite powerful, because we no longer need to use dependancy injection for just test purposes.

So much for security!

If you are booking online on Spicejet, beware.
The lovely site which says verisign secured etc. actually sends all your credit card information as a query string!
So much for SSL!

I had written to them around 2 months back and it still remains the same!

Friday, October 20, 2006

Sahi - New Website

Sahi has a new look and location at http://sahi.co.in.

A new release (Nightly Build 2006-10-20) of Sahi is also available. Download from here

Monday, October 09, 2006

Bird Fight

Just posted an image of a fight between a brahminy kite and a purple swamphen.
The swamphen stamps and chases away the kite!

Wednesday, October 04, 2006

Jamming thoughts

Travelling alone by car is a sin.
Why? It takes too much space on the roads.
The bigger the car the worse it is.
One car blocks roughly the space of four bikes.
So unless there are four people (at least) in a car, we are blocking resources which can be used more effectively.

Btw, bikes pollute more than new Euro IV cars (Source). So the problem is not straight forward.

There are a few things to consider:

What is the real problem? Road congestion or air pollution?
In Bangalore, it is road congestion. And it compounds air pollution. A car caught in congestion pollutes four times more than a running one (Source).

So if we have more free flowing traffic it is a big win. That means bikes are a decent option, and cars are not bad if fully utilized. Pooling in any form would help. Walking and cycling really are the best, but may not be feasible for everyone.

Pooling is kind of helpful in another way. One shares the stress of commuting and makes us human beings who snap less and who do not yell at the already poor pedestrian and the occasional cyclist.

Sad point is how the world sees it as a sign of success if you consume more resources and it may be perceived as below dignity for people to travel by cycle. Applause to those who have persevered cycling in Bangalore and because of their own profile are slowly making cycling be seen as cool and desirable.

Sad again that the right things have to be packaged as cool for most of us to accept it.

On a happier note, I hear less honking nowadays than I used to. People in Bangalore seem to be maturing to the traffic problem now. Cheers!

Wednesday, September 27, 2006


Treepie.org is up again. So if you are a birder and are looking for a site to consolidate your bird lists, join it and manage your lists.

I am now linking birds with superb pictures posted by the growing community of excellent wildlife photographers in India Nature Watch and pictures from google image search.

Monday, September 25, 2006


Chirdeep and I had gone owl hunting to this place called Turahalli. Do not know if we actually reached there but we did end up on a nice patch with lots of rocks around. No owls, but we managed to see rock agamas. Loads of them. Every rock was ruled by one.
Soon bored, bouldering entertained us briefly.
Then we came across a neat white cheeked barbet surprisingly sitting on an electric line absolutely unperturbed by our photographic intentions and let us come quite close to it.
Also managed a decent shot of a pied bushchat.

Sunday, August 06, 2006

Birding in Bannerghatta

Chirdeep, Nikhil and I went birding on Saturday. Got a few pics.

Purple sunbird in non-breeding plumage

Plain flowerpecker

Lighting a mosquito coil ...

Saturday, August 05, 2006

Blog for Sahi

Created a new blog for Sahi since there seem to be too many posts just on Sahi here.

That said,
Release 2006-08-06 with file upload facility has just come out

Toggling proxy on IE became easier with toggle_IE_proxy.exe and ProxyPal

And tons of thanks to Sriram Narayanan (Ram) for creating toggle_IE_proxy.exe
Seen few people who attack someone else's problem with such vigour and effect.
Taught me something...

Sunday, July 30, 2006

Automated file uploads, anyone?

Inspite of browsers playing spoil sport,
Sahi now handles file uploads too!

The strategy was to intercept the request in the proxy, read the file off the file system and insert it into the multipart request.

A workaround yes, but it at least works around!

Good thing is, it even records and plays back the file upload.

_setFile(_file("id"), "C:\\abc\\efg.jpg");

The file has to be present on that path on the machine running the proxy.

Coming up in the next build ...

Tuesday, July 25, 2006

A salute to the medicos

With immense gratitude do I write this.

My love for sports and my ignorance of the fragility of the human body made me totally tear my ACL ligament in my right knee and was rendered limping for more than a year. I could never imagine myself playing ever again.

But after 2 surgeries on my knee to reconstruct my ligament and a long lull and some intermittent exercises I ran the half marathon a year back and now for the past one month I have been doing what I thought was absolutely impossible then - playing football.

Last weekend was kind of a proof of concept for me when after a good exhausting game of football, I went cycling for some 80 kms the next day.

Thanks to those doctors who let me experience the feeling of wellness that I feel now.

And hey life, I am back!

Waiting for Build?

Our team's love for anagrams made Nikhil and I come together to make this simple timepass site called http://www.waitingforbuild.com

We atleast no longer pester each other for anagrams. Just hit the site and move around the letters.

It has some cool (yuck!) dhtml stuff too! ;)

Friday, June 09, 2006

Sahi Nightly Build 2006-06-06 released

Tested with 200 consecutive tests.

Made the following changes:

* Fixed bug for some submitted pages not working properly on IE
* Added socket pool to prevent Connect exceptions when there are a lot of tests
* Fixed bug to prevent injection of html code into js files
* Added documentation for _callServer and a few other apis
* Displaying an error page when remote server is down. Tests do not stop anymore.

Friday, May 19, 2006

Sahi Flash Tutorial

A Flash tutorial has been added to the Sahi home page.
It can be accessed at http://sahi.sourceforge.net/sahi_tutorial.html

If you like it, spread the word.

Monday, May 15, 2006

Sahi Nightly Build 2006-05-15 released

Release 2006-05-15 is a very enhanced release.
It contains the following fixes:

SSL certificates for proxy are generated automatically and on demand using keytool.
This fixes the security alerts problem.
Triggering keyboard events when value is set to textboxes.

Fixed bug which caused improper functioning in popups.
Fixed bug which caused null pointer exception when content type was not set.
Fixed bug where _table(index) was not working properly.
Fixed bug for multiple submit buttons on IE.

Thursday, May 11, 2006

Sahi ranked 55 out of 118720 projects

Current Sourceforge ranking of Sahi is 55.
Out of a total of 118720 projects.
Never dreamed of under 100.
Hope sourceforge does not say "we have a flaw in the statistics" ...

Wednesday, May 10, 2006

Under 150

Sahi's sourceforge ranking is now 146.
Today's ego boost :)


Sahi - HTTPS support

Another 6 hrs of late night work yesterday
and I have almost all my https woes solved.
Even though Sahi could handle https before,
it was using a single certificate for all https websites,
causing browsers to report mismatch in the certificates.
With a mix and match of on demand generation of certificates using keytool,
and per website creation of certificates and some caching,
I have Sahi handling SSL so smoothly that
all I have to do is accept the certificates just once,
when I first visit a site and then totally forget about it.

If you have a https website to test, it is going to be a no brainer to automate it using Sahi. Await the next release. I shall post soon.

Now the only big issue left is web pages from multiple domains embedded into the frames of a frameset.

Of course there are a few bugs ... ;)

Monday, April 24, 2006

Sahi - Nightly Build 2006-04-24 released

This release of Sahi has the following changes:

The whole code base has been rewritten to be easily extendable.
Various optimizations have been made for speed.
This release includes a few important bugfixes related to cookies.
_dragDrop(elementToDrag, targetElementToDropOn)
_callServer("ServerClass_method") have been added.

Documentation has been given a face lift.

Check out http://sahi.sourceforge.net/ for the changed look and feel.

A mailing list sahi-users@lists.sourceforge.net has also been created.

Thursday, April 13, 2006

Sahi and Scriptaculous and lighttpd

Yogi's Stock Hive application and Scriptaculous demos had something very interesting in that they refused to work correctly when I used the Sahi proxy.
This was purely the proxying part and had nothing to do with javascript handling.

The problem apparently lay in the way cookies were being sent.
Cookie headers are sent to the server as
Cookie: cookie1=value1; cookie2=value2; cookie3=value3
While rebuilding cookies on the proxy, it was being sent as
Cookie: cookie1=value1; cookie2=value2; cookie3=value3;

The last semicolon after value3 was the root of the problem.
lighttpd seemed to think that the value of cookie3 was 'value3;' thus missing the session cookie.

The RFC seems to say that this behaviour is right, but most mainstream web servers seem not to mind this.

Crux is, Scriptaculous and Stock Hive both work now through the proxy. Now to get the AJAX and dhtml rich Scriptaculous to be scripted and played back.

Wednesday, March 29, 2006

Testing SMTP settings

Came upon this link for testing SMTP server using telnet.
Was very useful in verifying whether the settings are right before deploying our j2ee app on a remote server.
Also realized that the WebLogic domain needs a restart if settings in the JNDI Mail Session are changed.

Tuesday, March 21, 2006

Sahi vs Selenium vs Watir

Updated thorough comparison of Sahi vs. Selenium

THIS IS A VERY OLD COMPARISON AND IS NOT TRUE ANYMORE Click here for the latest: Updated thorough comparison of Sahi vs. Selenium

A brief comparison. Please let me know if any information is incorrect.
Added Watir related data from Chris McMohan's comments:

Browser basedyesyesyes
Browser type independent (IE, Firefox etc)IE & FireFoxyesyes
Scriptable/programmable (manageable/refactorable)yesnot natively, but using rubyyes (uses javascript)
RecorderyesOnly on Firefox. yes
Object spynonoyes (hovering on any element,shows its accessor)
Simultaneuos playback of multiple scripts(reduces playback time)yesnoyes
Multiple domain support (go from google.com to thoughtworks.com)yesnoyes
Frames and popup supportyeshas problemsyes
Ant support (helps continuous integration)yesyesyes
Multi language (non-ascii character)supportyesyes
HTTPS supportyes(Protocol independent)yes
Learning curveLearn RubyRecorder reduces the need to write code.TextPad Clip Libraries can be used too.
Language of scriptingRuby - not native to the browserRuby - not native to the browserJavascript - native to the browser andhence easily extendable.
Web-app independentyesno - needs to be deployed with appyes
OS Independentnoyesyes

Comments from Chris McMohan which I have incorporated into this comparison:
Actually, Watir has
a Firefox interface (version 1.0 just released, called "FireWatir")
a Recorder
methods intended for use at the command line like "show_links" so an object spy isn't necessary
Simultaneous playback (via Ruby threads)
Frames support (really excellent frames support)
Popup support native in version 1.5 (coming soon)
Ant support (not sure what you mean, but Ruby can be integrated with CruiseControl)
non-ascii character support (via Ruby)
Learning curve: Watir *is* a DSL for scripting the IE DOM. Ruby is just a bonus. :)


Monday, March 20, 2006

Sahi in London

"That was amazing!"
"That's the coolest thing I have seen!"
"If you haven't seen the demo, you should see it."
"Convincing customers to use this tool should be very very easy."

A few remarks from those who saw a demo of Sahi in the ThoughtWorks UK office.

I am grateful for the appreciation.

Just made another release of Sahi. Changes include automatic opening of Controller Window, and syntax highlighting files for TextPad.

Tech support emails have just started trickling in and it feels good to know someone else in this world is also finding this tool useful!

Sunday, February 12, 2006

Cookies and policies

Never knew IE6 and the newer browsers had security restrictions on cookies. Heard for the first time about "compact privacy policy" and "third-party cookies".

A few good links.

Friday, February 03, 2006

Sahi vs ...

2 weeks of work and the newly released Sahi has a better controller GUI, better log reporting, and some bugfixes for multidomain support.

I have been asked many times as to why I am developing yet another web testing tool. My answer is that what we have so far really does not address complex web pages with frames, popups and frame breaking code.

As I realized on watching the progress of development on Selenium, it seems like people have started moving towards Ruby Selenium as it gives better control for the QA to organize code. The popularity of Selenium also seems to say that a visual indication for tests run is very much wanted. And of course the Selenium recorder has been really appreciated.

Combining all these concepts, but taking a totally different approach of injecting code into web pages (unintrusively as far as I know) which attaches handlers to elements, Sahi is able to do absolutely anything at all with the browser and the web page.

The Sahi script is essentially javascript, but is parsed on the Sahi proxy to achieve objectives like delayed execution.

A recorder makes the tool extremely useful as one can easily write mundane scripts, and then refactor it.

One place where it beats professional tools is in multithreaded playback and the way it does not require the test screens to be in focus, leaving you to carry on with your work, while it chugs (sails really) away in the background.

There are still quite a few bugs to be fixed and functionality to be added, but I think it is for grabs for people who wish to use a testing tool with almost all the features of a professional tool and more, but of course, want them absolutely free ;)

Putting Sahi on sourceforge has been one of my more satisfying moves, just for the fact that the daily statistics of the number of downloads really keeps my enthusiasm to add and rectify functionality to it. And of course it has made ego surfing more pleasureable!