Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This page discusses

Excerpt

how to use NekoHTML, HtmlUnit, Watij and WebTest to test web applications

.
There are many ways to test Web Applications with Groovy:

...

The following example tests the Google search engine using Watij:

Code Block
import watij.runtime.ie.IE
import watij.finders.SymbolFactory

def ie = new IE()
ie.start('http://www.google.com')
// check page title
assert ie.title() == 'Google'
// fill in query form and submit it
ie.textField(SymbolFactory.@name, 'q').set('Groovy')
ie.button(SymbolFactory.@name, 'btnG').click()
// check groovy home page appears in list by trying to flash() it
ie.link(SymbolFactory.url, 'http://groovy.codehaus.org/').flash()
ie.close()

...