Chapter 12. Presentation-layer testing
If debugging is the process of removing software bugs, then programming must be the process of putting them in.
Edsger Dijkstra
This chapter covers
- Introducing presentation-layer testing
- Testing with HtmlUnit
- Testing with Selenium
Simply stated, presentation-layer testing means finding bugs in the graphical user interface (GUI) of an application. Finding errors here is as important as finding errors in other application tiers. A bad user experience can cost you a customer or discourage a web surfer from visiting your site again. Furthermore, bugs in the user interface may cause other parts of the application to malfunction.
Because of its nature and interaction with a person, GUI testing presents unique challenges and requires its own set of tools and techniques. This chapter covers testing web application user interfaces.
We address here what can be objectively, or programmatically, asserted about the GUI. Outside the scope of this discussion are whether the choice of subjective elements like fonts, colors, and layout cause an application to be difficult or impossible to use.
What we can test is the content of web pages to any level of detail (we could include spelling), the application structure or navigation (following links to their expected destination, for example), and the ability to verify user stories with acceptance tests.[1] We can also verify that the site works with required browsers and operating systems.