Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Selenium Design Patterns and Best Practices
  • Toc
  • feedback
Selenium Design Patterns and Best Practices

Selenium Design Patterns and Best Practices

By : Kovalenko
3.9 (11)
close
Selenium Design Patterns and Best Practices

Selenium Design Patterns and Best Practices

3.9 (11)
By: Kovalenko

Overview of this book

Selenium WebDriver is a global leader in automated web testing. It empowers users to perform complex testing scenarios with its simple and powerful interface. This guide will provide you with all the skills you need to successfully create a functional Selenium test suite. Starting from the very beginning of the Selenium IDE, this book will show you how to transition into a real programing language such as Ruby or Java. You will quickly learn how to improve your code quality with refactoring and the skills needed to plan for the future development of your website to future-proof your test suite. With ample test examples running against a life-like e-commerce store and detailed step-by-step code review and explanations, you will be ready to test any challenge web developers might throw your way. This book is intended for anyone who wants to create a test suite that is easy to maintain by expanding your knowledge until you feel truly confident and comfortable with Selenium.
Table of Contents (11 chapters)
close
10
Index

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 to get it into a better overall shape. We will cover the following topics:

  • Refactoring tests
  • The DRY principle
  • The DRY testing pattern
  • Setup and teardown methods
  • The Hermetic test pattern
  • Test independence...
bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete