Monday, 28 November 2011

WET Functional Testing Tool

WET is a opensource web automation testing tool which uses Watir as the library to drive web pages. You dont have to download / install Watir separately or know anything about Watir. Watir is the library that WET uses and it is automatically installed for you.
WET drives an IE Browser directly and so the automated testing done using WET is equivalent to how a user would drive the web pages. Using WET, you can perform all the operations required for testing web applications – like automatically clicking a link, entering text in a textfield, clicking a button etc. WET allows you to perform various checks as a part of the testing process by using Checkpoints.
WET uses Ruby, a powerful object oriented scripting language. that lets you acheive just about any level of automation that they require.
Latest release:  1.0.0
To Download the WET Release 1.0.0, link here
Parametrize tests 
Two ways:
1.       Regular
e.g.
param1 = transaction_parameter(1)
param2 = transaction_parameter(2)
 Browser(“title” => “Arrow Emblems : Login”).TextField(“label” => “User ID:”).set param1
Browser(“title” => “Arrow Emblems : Login”).TextField(“label” => “Password:”).set param2
2. Data-driven tests using datatables
Put this into ur script & use the Datasheet which is stored at particular location which is used as follows,
Use datatables :- The use of datatables allows the same test script to be easily reused against multiple data inputs. These data inputs are specified in either a excel datasheet, an xml file or in a csv format. To allow a script to use datatables, these scripts must be designed such that they can accept parameters.
For more information, please go to the link as given below,
The concept of datatables is used to test more than one set of data for the same test scripts. For example if you have a script that tests registration, then you can test the script for different categories of data without having to rewrite the scripts for each test. The most common way to use datatables is to retreive data from a table or spreadsheet.
WET supports datatable through Microsoft Excel or by using a XML based datatable. The limitation is that every test can only retrieve data from one single excel file. The required data must be stored in the first worksheet. The format for entering data in a datatable is as follows:
  1. Data must be stored in the first worksheet of the specified excel spreadsheet.
  1. The first row of the spreadsheet represents the data ‘fields’. For example, in an employee datatable, the fields may be a) Employee ID, b) First name, c) Last Name, d) Date of Birth and e) Date of joining.
  1. The first column of the spreadsheet represents the category of data. During any testing assignment, one of the tester’s goal is to test the application for various categories of data. For example, you may want to test the employee database for a) first employee,
    b) last employee, c) Employee who barely qualifies as eligible to work, d) Employee who is a senior citizen, etc.,
For the above case, the spreadsheet looks as follows:
While running the tests, to retrieve data, you can use the utility method,
datatable().item(field, category)
Your script to create an employee could then look like:
Employee datatable example
all_data=["first_emp", "new_emp", "young_dude", "elderly_sir"]

all_data.each do |dt|
    Browser(...).TextField("name:=empId").set datatable().item("id", dt)
    Browser(...).TextField("name:=fname").set datatable().item("fname", dt)
    ..
    ..
end
eg. 
Script:
all_data=["first", "second"]
all_data.each do |dt| 
Browser(“title” => “Arrow Emblems : Login”).TextField(“label” => “User ID:”).set datatable().item(“User_id”, dt)
Browser(“title” => “Arrow Emblems : Login”).TextField(“label” => “Password:”).set datatable().item(“Password”, dt)
Clearly the above utility provides a very simple yet organized way of testing the same scenario using multiple data.
Instead of using an Excel sheet, you could also use an xml syntax. The XML schema for the datatable is:
XML Datatable schema.  If the Datatable is in an XML Format, then an example is :
<data>
  <category name='general'>
     <Item name="firstname" value="Me" />
     <Item name="lastname" value="Exists" />
     <Item name="employeeid" value="001" />
     <Item name="age" value="34" />
  </category>

  <category name='boundary'>
     <Item name="firstname" value="New" />
     <Item name="lastname" value="Girl" />
     <Item name="employeeid" value="100" />
     <Item name="age" value="26" />
  </category>
    <!-- You can have many more categories here -->
</data>

1 comment:

  1. Sir, I am MCA student. I want to become software tester or analyst, please, guide me.

    ReplyDelete