Book Image

Selenium Design Patterns and Best Practices

By : Dima Kovalenko
Book Image

Selenium Design Patterns and Best Practices

By: Dima Kovalenko

Overview of this book

Table of Contents (18 chapters)
Selenium Design Patterns and Best Practices
Credits
Foreword
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 2. The Spaghetti Pattern

 

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."

 
 --Martin Golding

Writing and maintaining any form of software is like fighting entropy; given enough time and changes, any code base will gradually decline into disorder. A test suite is a closed system; if you do not provide energy in constant upkeep and planning, the suite will deteriorate and will fail constantly. Every new feature and line of code added to our website makes our test suite obsolete. The only way to fight back these natural forces is to constantly upgrade and improve existing tests.

In this chapter, we will start to grow our test suite organically and take a look at an anti-pattern called the Spaghetti pattern. Along the way, we will pick up some more basic skills, such as using XPath and CSS selectors to locate the elements on a web page.

Note

The term anti-pattern was inspired by a great book on software design called Design...