I recently read an article on Groovy Functional Testing with Geb, published on jaxenter.com. It provides a really nice introduction to functional testing and page objects. It also gets you thinking about the advantages of using Groovy rather than Java for browser automation. This integration is certainly worth considering for Arquillian Drone (see ARQ-977). Especially since the article claims that "Geb is the most elegant and powerful browser automation tool available today." If that's so, we want that power in Arquillian
Here are a few of the topics covered in this article that I think are relevant for this group:
- A definition of functional testing
- The state of functional testing today
- An in-depth introduction to the page object pattern
- Introduction to Geb and Groovy for (web-based) functional testing
The article defines functional testing as:
Unlike unit testing, functional testing ignores the specifics of the underlying software component under test. A functional test merely asserts that providing certain input results in certain output. In the context of a web application, this usually means programmatically controlling a web browser to simulate the actions of a user on a web page.
We also see in this article a line that we use often when presenting the value of the Arquillian platform:
...traditional unit testing only goes so far. Some of the most serious bugs in a web application tend to be things a unit test has no way to check for
Of course, there is no silver bullet for testing. Testing is multi-faceted. Unit tests just happen to be simpler to write and comprehend. We focus a lot on more complex testing because traditionally it's been very hard.
The article identifies page objects as one of the key ways to make web-based testing simpler:
Page Objects [reduce] test fragility by letting you reason about your web pages and components as though they were part of an object hierarchy. If the structure of a page changes, you need only update a selector in one place within your Page class—often, no changes to the test code itself are required.
In other words, page objects adhere to the DRY principle.
Even if you aren't interested in writing tests in Geb / Groovy, the article is worth reading for its in-depth introduction to page objects. Check it out and let's discuss.