Watir – Web Application Testing in Ruby

Watir - Web Application Testing in Ruby"Watir" (pronounced water) stands for "Web Application Testing in Ruby". Watir is an automated test tool which uses the Ruby scripting language to drive the Internet Explorer web browser. Watir is a toolkit for automated tests to be developed and run against a web browser.

Plan what you need to get Watir to do before you begin scripting. Open your web browser with the application under test in front of you, and pay close attention to the objects on that page. What text fields require entries? What buttons need to be pushed? What links need to be clicked on? It sometimes helps to write out the steps it will take to exercise a test first, and then filling in the Watir scripting code to satisfy each of those steps.

It is a good idea to view the source of the page (in Internet Explorer, right click and select View Source) and get an idea of what the attributes of the objects you need to interact with are.

To start developing a test:

  1. Open your text editor.
  2. Name your test file with a .rb (Ruby) extension.
  3. Provide your new test file with access to the Watir tool by entering this statement at the beginning of your test script: require ‘watir’
  4. Open Internet Explorer and navigate to the application you wish to test
  5. Interact with it to design your test case
  6. Using the Watir methods below, type the corresponding Watir methods into your test script
  7. Verify the result

It’s interesting to see that you can interact with all the elements of a webpage such as : buttons, URL, checkboxes, radio buttons, IDs,frames  and others.

So once the script is done, you just load it and run it. I didn’t have time to check it inside out, but I think it’s a great web application testing framework which deserves more coverage and exposure.

Find out more about Watir on the project’s website.

Thank you for reading this post. You can now Leave A Comment (0) or Leave A Trackback. Print This Post Print This Post

Subscribe without commenting

Leave a Reply

Note: Any comments are permitted only because the site owner is letting you post, and any comments will be removed for any reason at the absolute discretion of the site owner.

CommentLuv badge