Background Image
Table of Contents Table of Contents
Previous Page  424 / 478 Next Page
Information
Show Menu
Previous Page 424 / 478 Next Page
Page Background

By the end, you might end up with something that looks like

Figure 21-1

.

Figure 21-1. Sharing lists

The Page Pattern, and the Real Exercise for the Reader

Apply DRY to your functional tests

Once your FT suite starts to grow, you’ll find that different tests will inevitably find

themselves using similar parts of the UI. Try to avoid having constants, like the

HTML IDs or classes of particular UI elements duplicated between your FTs.

The Page pattern

Moving helper methods into a base

FunctionalTest

class can become unwieldy.

Consider using individual Page objects to hold all the logic for dealing with par‐

ticular parts of your site.

An exercise for the reader

I hope you’ve actually tried this out! Try to follow the “Outside-In” method, and

occasionally try things outmanually if you get stuck. The real exercise for the reader,

of course, is to apply TDD to your next project. I hope you’ll enjoy it!

In the next chapter, we’ll wrap up with a discussion of testing “best practices”.

396

|

Chapter 21: The Token Social Bit, the Page Pattern, and an Exercise for the Reader