Wednesday, December 21, 2005

www.greedyme.com

Nice site. A free universal wish list site.

Check out me list here

Friday, December 16, 2005

Selenium 'AndWait' timeouts

We are using Selenium at work for our UATs. Our continuous integration server is running our UATs after each commit to verify the app still works as expected.

A reoccuring problem has been button on pages that only sometimes cause postbacks. The issue is that when a postback is caused you have to use the command 'clickAndWait' when no postback occured you just use 'click'. So.. if you use 'clickAndWait' and there is no postback Selenium sits there waiting for a page refresh that will never come. In effect the test runner hangs.

Our build process has a timeout set, so eventually the nant task running the UAT times out.. This has to be set pretty long as currently the UATs are taking 20+ mins. As a result we are not getting fast enough feedback.

My Solution...

I hacked away at the selenium code a bit to introduce a timeout for all 'AndWait' commands.

Here is the code changes:

In selenium-executionloop.js I replaced

/**
* Busy wait for waitForCondition() to become true, and then continue
* command execution.
*/
this.pollUntilConditionIsTrue = function () {
if (this.waitForCondition()) {
this.waitForCondition = null;
this.continueCommandExecutionWithDelay();
} else {
window.setTimeout("testLoop.pollUntilConditionIsTrue()", 10);

}
};

with

/**
* Busy wait for waitForCondition() to become true, and then continue
* command execution.
*/
this.pollUntilConditionIsTrue = function () {
LOG.info("Polling:");
this.pollUntilConditionIsTrueWithTimeout(2000);
};

this.pollUntilConditionIsTrueWithTimeout = function (timeoutChances) {
if (this.waitForCondition()) {
this.waitForCondition = null;
this.continueCommandExecutionWithDelay();
} else {
if (timeoutChances <= 0)
{
var message = "'AndWait' command timed out.";
LOG.error(message);
this.commandError(message);
this.testComplete();
}
else window.setTimeout("testLoop.pollUntilConditionIsTrueWithTimeout("+ (timeoutChances -1) +")", 10);
}
};



It is not tested on anything other than IE, and no unit tests... but it seems to work for us.

Friday, December 02, 2005

Custom Radio Station

I am totally impressed with Pandora. A site that allows you to specify songs or artists that you like and by doing so create a customized radio station.

Nice solution to time sheet problems

I believe that as a professional I must be accountable for how I spend my working hours. I should be able to answer questions like "How long did feature X take to implement?", "Why did Y take so long?" and "What have you been working on for the last week?". My memory is not always up to this challenge.

To solve this I wrote a very simple 'proactive time tracker'. It regularly pops up a message box to ask "What have you been doing for the last X minutes?" and logs the answers. This allows me to automatically record what I got up to in a day.

Another project trying to solve this same problem is: TimeSnapper

It takes regular snapshots of your screen (at configurable interval and resolution) and allows you to later play this back as a movie :) or jump to any point in time.

I reckon it's a nice solution. I am looking forward to replaying my week :)

GitHub Projects