Friday the 13th

This year my birthday fell on the most notorious date of history…Friday the 13th.I was curious to know about the significance and reason for why this date brings horror in mind.I googled for it and found many thing about it.

But the most striking moment of my life was when this date hit me too. I am not a superstitious kinda person but this incident made me to think again. The incident goes like…

I was on verge of finishing a project.But as usually clients demand for a last minute changes my client asked to change a default value of a date in dateselect_tag to year 2100.I didnt mind as it was a kids play.

I made changes in code

@default_date = Time.utc(2100,"jan",1,0,0,0)

It looked fine but when i run the application again it collapsed with

 ArgumentError in Admin/account#new

 time out of range

I coudnt figure out what the problem was.den i changed the year to 2035 it worked fine.I tried different combinations and found it dont work for year greater then 2038 but dont know the reason.

Finally i look up to google for help.And as google usually do Google helped me hare too.And now what i found out was the most amazing thing in my life.see what i found in google .

If you follow the link you will know what my problem was. You see ruby is also 32-bit system so its affected too. The problem in short is …

 " 32-bit signed integer, such as a time_t, set to its maximum value of 2 147 483 647 and then incremented by 1, will become -2 147 483 648.  Note that "-" sign at the beginning of this large number.  A time_t value of -2 147 483 648 would represent December 13, 1901 at 8:45:52 PM GMT. "

The point that took me aback was December 13, 1901 at 8:45:52 PM GMT is going to fall on Friday .So you see i got another example of Friday the 13th horror among not at all superstitious IT community. Well this was actually an overstatement as nothing can horrify IT community :) this bug is easily fixable and by the year 2038 no one knows where would these fast growing techs. be taking us. I m proud to be a member of this community :)

testing rails application

Have been busy recently comparing Rails 1.1’s integration testing and WATIR and selenium for end-to-end testing a rails application.

The testing scenario is that the webserver is running on a remote Linux box in US, to which we have ssh access.
And we are testing the application from India. So we cannot run the browser on that machine.

We are writing test cases for various parts of the application using each of these tools and then we would compare notes.

A few things however are clear rightaway.

WATIR will test only for IE on windows. Firefox support for watir called firewatir is being built, and is not robust as of now. Also we might need different sets of test scripts for firefox and IE.

Selenium is the easiest to get started in the BrowseBot FITRunner mode; haven’t tried the “driven” mode yet. FIT mode would not allow us to verify values on the screen against those in the db… but then probably those tests should go into the “controller testing”(functional testing) and not be at this level. When we want to test against db for multiple controllers then rails’ integration testing is the probably the best way.

Running selenium in “driven” mode will take some research, for which i have not been able to spare time.

WATIR requires ruby and watir gems to be installed on the client computer. Hence if we want to share UI tests with our non-technical client, Selenium is better since it requires no installation.

From the aspect of writing test cases, WATIR is better than selenium’s FIT mode. Selenium test cases need to be written in html. And there is no control flow in the selenium core, though there is a user contributed library for this.

For certain kind of testing, such as against db values and checking values in session, Rails functional tests and integration tests are great.

Will share more experiences on this when we are through with the exercise.

How has your experience with these tools been?

Received this profound quotation in my email today.

“The greatest good you can do for another is not just to share your riches, but to reveal to him his own.”
Benjamin Disraeli
1804-1881, Former British Prime Minister

Rails Project

We are working on our first Rails project. Will update this post with more details as soon as we reach a stable release.