Chapter 3. Refactoring Tests

 

"A bear, however hard he tries,

Grows tubby without exercise...."

 
 --A. A. Milne, "Teddy Bear" from The Complete Poems of Winnie-the-Pooh

Exercise is an important part of keeping your body fit; however, it can be easily despised. Exercising takes a lot of work, causes a lot of physical pain, and gives very few instant results to keep you motivated. Our test suite needs some upkeep and refactoring to remain in pristine condition.

In the previous chapter, we wrote two tests but we did it in a quick and sloppy manner. A lot of code was duplicated, and simply copied and pasted. If we keep growing our suite in a similar manner, it will become unmanageable in no time! In this chapter, we will put our test suite on a treadmill ...

Get Selenium Design Patterns and Best Practices now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.