Unit tests are a natural way for programmers to defend their code against regressions. Unit tests are lightweight and easy to run. Writing unit tests should be as easy as writing print statements. JUnit (http://www.junit.org/) is a popular unit test framework for Java; TestNG (http://testng.org/doc/index.html) is another.
This recipe uses Webdriver and HtmlUnit in combination with TestNG to write simple and automated functional tests. Using HtmlUnit instead of a real browser makes for stable OS agnostic tests, which, although does not test browser compatibility, can spot the majority of functional failures.
Create a project directory.
pom.xmlwith the ...