Watij – Web Application Testing in Java

Watij (pronounced wattage) stands for Web Application Testing in Java. Watij is a Java API created to allow for the automation of web applications. Based on the simplicity of Watir and enhanced by the power of Java, Watij automates functional testing of web applications through a real browser.

Watij’s new WebSpec API supports the following browsers on Windows, Mac, and Linux:

  • Internet Explorer
  • Mozilla
  • Safari

You can also use JRuby!  Watij’s WebSpec API provides a JRuby extension so you get the power of Ruby and Java combined.

Please join our Google group for Watij and post any questions you may have or just browse the topics to see what is possible!

It’s so easy!

Just download Watij’s WebSpec, unzip, install in your favorite IDE and you are ready to start scripting your tests.

See how easy it is to script a search on Google:

Java using Mozilla

Spec spec = new Spec().mozilla();
spec.open("http://www.google.com");
spec.find("input").with("name=='q'").set("value='Watij'");
spec.find("input").with("type=='button'").with("value=='Google Search'").click();
//check results
spec.find("a").with("href=='http://watij.com/'").shouldExist();

JRuby using Internet Explorer

spec = Spec.new.ie
spec.open "http://www.google.com"
spec.input.name('q').value = "Watij"
spec.input.type("button").value("Google Search").click
#check results
spec.a.href("http://watij.com/").should_exist

Now don’t stop here! Take a look at the documentation.txt included in the download and begin writing your Watij test scripts in test runners like JUnit or others like TestNG.