Watir to WebDriver: Unit Test Frameworks

Visit the post for more.

Justin Bishop
6 min readintermediate
--
View Original

Overview

The article discusses the transition from using Watir to WebDriver for unit testing at Facebook, highlighting the evolution of testing frameworks and the integration of new technologies. It emphasizes the benefits of adopting WebDriver for improved automation and testing efficiency.

What You'll Learn

1

How to transition from Watir to WebDriver for browser testing

2

Why WebDriver improves browser automation over Watir

3

When to implement a new testing framework in a development cycle

Prerequisites & Requirements

  • Understanding of Ruby and PHP testing frameworks
  • Familiarity with WebDriver and Watir(optional)

Key Questions Answered

What are the advantages of using WebDriver over Watir?
WebDriver allows for more accurate and powerful browser automation compared to Watir, which relied on JavaScript. The introduction of WebDriver's HTTP request protocol also enables language agnosticism, making it easier to integrate with existing PHP testing frameworks.
How did Facebook improve its testing processes with WebDriver?
Facebook transitioned to WebDriver to enhance its testing processes by allowing tests to run automatically when code changes are made, thus providing immediate feedback on test failures. This shift also enabled better integration with their existing PHP unit test system.
What challenges did Facebook face when using Watir?
Watir was not integrated into the development flow, meaning tests did not run automatically upon code changes, leading to delayed notifications of failures. Additionally, it was the only significant Ruby code within the company, complicating the testing architecture.

Technologies & Tools

Some links below are affiliate links. We may earn a commission if you make a purchase.

Testing Framework
Watir
Initially used for browser testing before transitioning to WebDriver.
Testing Framework
Webdriver
Adopted for improved browser automation and integration with existing PHP tests.
Programming Language
Php
Used for developing the new WebDriver client and existing unit tests.
Programming Language
Ruby
Used in the original Watir framework for testing.

Key Actionable Insights

1
Consider adopting WebDriver for your browser testing to leverage its improved automation capabilities.
WebDriver's ability to handle browser interactions more accurately can lead to more reliable test outcomes, especially in complex web applications.
2
Integrate your testing framework with your development workflow to ensure tests run automatically.
This practice minimizes delays in identifying issues, allowing for quicker iterations and higher code quality.
3
Evaluate the need for a transition to a new testing framework when current solutions become limiting.
As technologies evolve, being open to change can enhance productivity and testing effectiveness.

Common Pitfalls

1
Failing to integrate testing frameworks into the development workflow can lead to delayed feedback on test failures.
This often results in engineers not being aware of issues until much later, which can slow down the development process and lead to more significant problems down the line.