Saturday, October 17, 2009

Sea Biscuit(2003)

Sea Biscuit(2003) is an amazing movie.
Have seen it few times and won't be bored to see many more times.
Well written by Laura Hillenbrand and nicely screen played by Gary Ross.
I liked the four main characters, Tom smith (played by Chris Cooper),
Red (played by Michael Angarano),
sea Biscuit and Charles Howard (played by Jeff Bridges)
Loved their expressions, especially Tom Smith's facial expressions at times for the dialogs of Charles Howard.

The story line was awesome, it clearly shows the mix of right people with greate attitude put together can achieve anything even if they lack in some way. Small Horse, Tall Jockey, Old Trainer and the Owner. Small Horse had the spirit to win the well built horses. Tall jockey had the attitude to understand and mingle with it and beat all the right sized(short) jockeys. Old Trainer could clearly judge the horses, train them, and correct the jockeys mistakes. The Owner had picked the right trainer and he was there whenever they need or any one of them fail.

Few of best dialogs that i liked from this movie are

"You know,you don't throw a whole life away...
just 'cause he's banged up a little."

"Brick by brick my citizens, brick by brick." - by The Roman Emperor, Hadrian

It ain'tjust the speed. It's the heart.

Friday, September 11, 2009

Selenium - Testing AJAX Web Applications

In AJAX applications, we do not reload the whole page, instead we update part of the page based on the response. To test these applications we cannot use wait_for_page_to_load() or wait_for_frame_to_load() or alert_is().

In these cases, we have to use the wait_for_condition() selenium API.
Key thing to observe here is that the code that you write in the condition is in javascript.
In the following example, I am waiting for the alert for 60000 milliseconds. This alert is poped up after updating the page based on the AJAX response.

my $cond = "try{ if(selenium.getAlert().indexOf('Package successfully deployed') > -1){true;} } catch(ex) {}";
$Common::sel->wait_for_condition($cond, 60000);

Wednesday, September 09, 2009

Selenium - alert and confirm in the page's onload() event

Selenium does NOT support _javascript_ alerts that are generated in a page's onload() event handler. Selenium does NOT support _javascript_ confirmations that are generated in a page's onload() event handler.

You may have some alert in the login page to display some alert on invalid username and password. When you want to automate the test cases on those pages, you need to add some javascript code on those pages before displaying the alert or confirm. These following lines makes the selenium to capture the alert or confirm messages.
var browserbot = parent.selenium.browserbot;
if (browserbot) {
browserbot.modifyWindowToRecordPopUpDialogs(window, browserbot);
}
alert("Alert message after those selenium workaround js snippet");

Sunday, September 06, 2009

Selenium - How to check the disabled button?

If you are using the Selenium IDE, you cannot record a test to check the disabled button. Instead of recording you can use the selenium perl driver API and code the test.
If I am testing the disabled state of a button with an id="pingBtn" in the HTML page, use the is_editable API and check the disabled state.
API doc:
$sel->is_editable($locator)
Determines whether the specified input element is editable, ie hasn't been disabled.This method will fail if the specified element isn't an input element.

$locator is an element locator
Returns true if the input element is editable, false otherwise
Compare the return value to false (0) to check the disabled state and add a comment which will be printed on the test console.
ok($sel->is_editable("pingBtn") == 0, "is_not_editable, pingBtn");

Wednesday, July 29, 2009

Brief Introduction about web development

I was explaining about the web development to one of my friend who is very good in C and Unix, but new to web development. Just thought of sharing the same notes in my blog.
Image export of mind map is here:


HTML export of mind map is here:

Web Dev

  • HTML

    • Structure of the web page, which is rendered by browser
    • Static pages

      • Navigation is linked by anchor/href tag
    • Dynamic pages

      • HTML Content is generated based on the database content
      • Actions are through buttons, which will submit the form

        • server is responsible to handle the request and respond back
  • JavaScript

    • Client side scripting

      • to avoid the load on the server

    • Used for client side validation
    • used for AJAX

      • Used to generate the dynamic web page
  • CSS

    • used for the styling of the web pages

      • Browser applies the CSS while rendering the web page

    • for common style across the application

    • helps to keep the HTML code clean

      • Improves maintainability

      • Improves readability

  • Server Side Scripting


    • executed at the server side to generate the dynamic HTML content

      Example: JSP, ASP, Velocity, DJango, etc

      Scriplet and HTML are placed in the same file and
      scriplet is executed just before server sends the HTML response
  • AJAX


    • Instead of form submit, a XMLHTTP call is made to the server and
      based on the result, part of the HTML page is rendered.
      In Traditional web dev, the response replaces whole HTML page,
      but in AJAX, part of the HTML can be updated based on the XMLHTTP response
      can make syncronous or asynchronous XMLHTTP calls