How to write test script in Watir

With the Watir testing tool one thing is very necessary that you must have some programming knowledge because Watir is not based on recording and playback concept. In Watir every script is written by tester before running it. If you want to test your web application by Watir then do one thing, open that page which you want to test and open the view source of page. Do you have knowledge about HTML? Because HTML knowledge is very necessary with Watir. If your web contains buttons, text fields, links, drop-down menus then you can write the script for these objects like this-

For Button you can write script like this but take that variable where you have opened IE browser.

variable_name.button(:name, "Button name").click

"Button name" this value should use according to source code.

variable_name (variable name)

button (Class name)

name (name of button)

Button name (name of button which is used in coding).

this syntax will click your button which is present on web page.

For text box.

variable_name.text_field(:name, "text box name").set ("Asit")

.set (this syntax will put your desired word in text box)

For hyper links.

variable_name.link(:text, "link name").click

.click (this syntax will tell to Watir that click link).

For drop down box.

variable_name.select_list(:name, "drop down box name").select ("drop down value")

.select (this syntax will tell to Watir that select drop down values).

So these are some scripts which I have described and I'll come with further discussions about Watir.

Watir

Last two days I spent my time on Watir (Pronounced “Water”) testing tool. It’s open source functional testing tool, means totally free to use and you can download this testing tool from here- Watir But like other testing tools it has some dependencies like it uses Ruby scripting language, IE browser and runs only on Windows. So to use Watir you must install Ruby on your system. It does not support other browsers like Firefox, Mozilla, and others. Watir is totally different from other testing tools like WinRunner, QTP and others because it does not support Recording and Playback concept. Now one question is ommited over here that how we can test our web application? So answer is that we can write test script in Notepad in Ruby scripting language and save with .rb extension and run this file through command prompt.

If you want to install Ruby or Watir testing tool then go to this link-

http://wtr.rubyforge.org/

Today I have written one basic script for Watir, which is given below. If you trying to understand that where we can start then follow this script.

# the watir controller

require ‘watir’

# Open one new IE browser

browser=Watir::IE.new

# Define one variable

test_site=”http://www.openapp.org

# Put the website address in Address Bar browser.goto(test_site)

So this is very small script for opening openapp.org site. If you want to run with Watir then it’s very necessary that you should learn some basics of Ruby.

Here I’m describing how this script works behind the window.

require ‘Watir’ If you want to use Watir testing tool then first type this syntax at the beginning of the script. This syntax allows our test script to use Watir testing tool.

test_site=”http://www.yahoo.com abc is simple variable which is having one URL. In Ruby every variable start with small latter.

browser=Watir::IE.new browser is also simple variable. This syntax tells Watir tool that open one new IE browser.

.new is Method (Please go through Ruby).

browser.goto(test_site) this syntax will tell Watir that put the abc contain URL on the address bar.

.goto is also Method.

So this is description about one small Watir script. I’ll come with further discussions and welcome your questions and suggestions.

Please Give Me Suggestions

I would like to say that I want to step in white box testing but I have little idea about that. I have knowledge about black box testing but not in white box. If anybody have any idea about white box testing that how it performs, works, techniques, and methods then please help me for step in. I also want to know about the available tools either automated or manual for white box testing. I'm looking for your response.

Testing On Joomla!

11.jpgToday I had no other work in my office for me so I thought that I should test any open source software. So I have followed instruction of openapp.org blog and installed one of the open source content management Joomla. I didn't have any idea about Joomla functionality that's why I'm just going through all link and tabs and trying to feel Joomla front look. I opened Joomla in both IE and Firefox. After going through some links and tabs, I found that Joomla have good UI. But like all applications it has some UI differences. Like when you go through Registration page there it shows some text boxes. I found that these text boxes are not aligned. This happens in IE browser. In this application I found some functional errors like when I go through “Contact” page, there it shows “Send an Email to this contact” block. Through this block user can send himself ID and message. According to my point of view if user leaves any field blank it should throw error and I found that it was happening. But there is some mismatch like when user enters Email ID in this format abc@abc.c, www.abc@abc.com. It gets delivered. According to my point of view it should throw error that “Please use correct Email ID”. I think written function for this functionality only compares with “@” and “.com” word. It doesn't matter that what word you use for starting the email id. There is one more mismatch that according to usability after sending message, confirmation message should show up of “Send an Email to this contact” but it's visible up of header and simple format not a bold format. Hey I'm discussing one more thing when you use this type of Email ID “abc@abc.” browser alerts you for the incorrect email id at that time the theme settings gets distorted.

I’m Confused

Toady one of my friend asked me about Verification and Validation process. He told me that Verification process is coming after project completion and Validation process is going through each stage of application. My problem is that, I'm thinking validation process is coming after project completion and verification process is going through each stage of application.

I have followed these definition-

Verification process is determination of correctness, completeness, and consistency of a program at each stage.

Validation process is determination of correctness of a final program with respect of it's requirement.

So if anybody have some idea about this then please suggest me. I'm desperately waiting for your response.