Free Sample
+ Collection

Selenium Design Patterns and Best Practices

Learning
Dima Kovalenko

Build a powerful, stable, and automated test suite using Selenium WebDriver
$19.99
$31.99
RRP $19.99
RRP $31.99
eBook
Print + eBook

Want this title & more?

$16.99 p/month

Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

Book Details

ISBN 139781783982707
Paperback270 pages

About This Book

  • Keep up with the changing pace of your web application by creating an agile test suite
  • Save time and money by making your Selenium tests 99% reliable
  • Improve the stability of your test suite and your programing skills by following a step-by-step continuous improvement tutorial

Who This Book Is For

Whether you are an experienced WebDriver developer or someone who was newly assigned a task to create automated tests, this book is for you. Since the ideas and concepts are described in simple terms, no previous experience in computer coding or programming is required.

Table of Contents

Chapter 1: Writing the First Test
Choosing Selenium over other tools
The Record and Playback pattern
Getting started with the Selenium IDE
Understanding Selenium commands
Comparing Ruby to Selenese
Comparing Selenium commands in multiple languages
Writing a Selenium test in Ruby
Summary
Chapter 2: The Spaghetti Pattern
Introducing the Spaghetti pattern
Testing the product review functionality
Reasons for failures
The Chain Linked pattern
The Big Ball of Mud pattern
Summary
Chapter 3: Refactoring Tests
Refactoring tests
The DRY testing pattern
The Hermetic test pattern
Creating generic DRY methods
The random run order principle
Summary
Chapter 4: Data-driven Testing
Data relevance versus data accessibility
Hardcoding input data
Introducing test fixtures
Using an API as a source of fixture data
Using data stubs
The default values pattern
Summary
Chapter 5: Stabilizing the Tests
Engineering the culture of stability
Waiting for AJAX
Waiting for JavaScript animations
The Action Wrapper pattern
The Black Hole Proxy pattern
Test your tests!
Summary
Chapter 6: Testing the Behavior
Behavior-driven Development
Testing the shopping cart behavior
Introducing Cucumber
Running the Cucumber suite
The write once, test everywhere pattern
Testing a mobile site
Testing the purchase API
Summary
Chapter 7: The Page Objects Pattern
Understanding objects
The Page Objects pattern
Creating a Page Objects framework
Running tests with the Page Objects framework
The test tool independence pattern
The right way to implement Page Objects
Summary
Chapter 8: Growing the Test Suite
Strategies for writing test suites
Continuous Integration
Frequently Asked Questions
Summary

What You Will Learn

  • Control Selenium WebDriver within any major programing language such as Java, Ruby, Python, and .NET
  • Learn how to implement a simple test script or a complex Page Objects framework
  • Set up each test to automatically deal with AJAX and jQuery
  • Remove test instabilities by blocking third-party services
  • Deal with data uncertainties by using fixtures, JSON APIs, and API stubbing
  • Improve your test suite continuously by refactoring code and using the DRY principle
  • Stabilize your tests by using patterns such as the Action Wrapper and Black Hole Proxy patterns

In Detail

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.

Authors

Read More