WATIR stands for ‘Web Testing Application in Ruby‘. It is an OLE-based testing application that automates your browser using Ruby libraries. Here are some of the pros and cons of Watir in brief at first glance.
Functionality of Watir
Watir takes advantage of the built-in OLE capabilities of Ruby to automate browsers. Normally, HTTP-based tools create a browser simulator for a web-based testing system. Watir works in a different way wherein it takes the browser through the OLE protocol. By implementing the OLE protocol over Component Object Model (COM) architecture, Watir facilitates inter-process communication between the browser and Ruby. Dynamic object creation and manipulation is made possible as well.
For Internet Explorer, this process is called OLE Automation. The program that manipulates objects is called the automation controller. The automation objects are served by the Internet Explorer which is why it is called as the server. On the other hand, the Ruby program acts as a client to manipulate objects.
WATIR Advantages
- Uses the Ruby library to facilitate OLE-based testing. This approach eliminates the need for an external server.
- Supports multi browsers and OS. You can write tests for new browsers as well.
- Offers a rich and intuitive interface. Easy to create code without requiring extensive documentation.
- One of the important features of WATIR is its ability to wait for the page to load. It detects when the page finishes loading. Moreover, tests run faster and are stable when compared with Selenium or Sahi.
- Another important feature is the Attach Method. You can programmatically attach the original domain window and the linked domain window. For instance, you use Facebook to login to an application. The login page of your application will load the Facebook domain. With other tools like Selenium, the actual application loses connection when the linked domain is opened and the application gets locked. However, WATIR lets you attach both domains so that you access the linked window and the original window from the same test.
WATIR Disadvantage
- Limited support to handle Popups. JavaScript generated popups such as Alert boxes, Windows Security popups, and other popups that are not contained in a web browser are not accessible the same way as the HTML pages are. There has been some experimental code packaged with Watir to deal with popups with limited success. A good popup handling solution is being worked on and will be included in a future Watir release.
- AUT Object repository/definitions are not available within the WATIR. Third-party tools such as MS Web Developer Toolbar have to be employed but have limited capabilities and usability.
- No Real-time Debugging options or debugger.
- Works only for Web-based application, does not has the capability to automate non web-based applications.
- There is no recording mode or any such mode to generate scripts automatically. Scripts have to be written manually.
- While WATIR supports multiple browsers, you have to use a different library for each browser. You have to learn Ruby as well.