Selenium Design Patterns and Best Practices
eBook - ePub

Selenium Design Patterns and Best Practices

Dima Kovalenko

Buch teilen
  1. 270 Seiten
  2. English
  3. ePUB (handyfreundlich)
  4. Über iOS und Android verfügbar
eBook - ePub

Selenium Design Patterns and Best Practices

Dima Kovalenko

Angaben zum Buch
Buchvorschau
Inhaltsverzeichnis
Quellenangaben

Über dieses Buch

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.

Häufig gestellte Fragen

Wie kann ich mein Abo kündigen?
Gehe einfach zum Kontobereich in den Einstellungen und klicke auf „Abo kündigen“ – ganz einfach. Nachdem du gekündigt hast, bleibt deine Mitgliedschaft für den verbleibenden Abozeitraum, den du bereits bezahlt hast, aktiv. Mehr Informationen hier.
(Wie) Kann ich Bücher herunterladen?
Derzeit stehen all unsere auf Mobilgeräte reagierenden ePub-Bücher zum Download über die App zur Verfügung. Die meisten unserer PDFs stehen ebenfalls zum Download bereit; wir arbeiten daran, auch die übrigen PDFs zum Download anzubieten, bei denen dies aktuell noch nicht möglich ist. Weitere Informationen hier.
Welcher Unterschied besteht bei den Preisen zwischen den Aboplänen?
Mit beiden Aboplänen erhältst du vollen Zugang zur Bibliothek und allen Funktionen von Perlego. Die einzigen Unterschiede bestehen im Preis und dem Abozeitraum: Mit dem Jahresabo sparst du auf 12 Monate gerechnet im Vergleich zum Monatsabo rund 30 %.
Was ist Perlego?
Wir sind ein Online-Abodienst für Lehrbücher, bei dem du für weniger als den Preis eines einzelnen Buches pro Monat Zugang zu einer ganzen Online-Bibliothek erhältst. Mit über 1 Million Büchern zu über 1.000 verschiedenen Themen haben wir bestimmt alles, was du brauchst! Weitere Informationen hier.
Unterstützt Perlego Text-zu-Sprache?
Achte auf das Symbol zum Vorlesen in deinem nächsten Buch, um zu sehen, ob du es dir auch anhören kannst. Bei diesem Tool wird dir Text laut vorgelesen, wobei der Text beim Vorlesen auch grafisch hervorgehoben wird. Du kannst das Vorlesen jederzeit anhalten, beschleunigen und verlangsamen. Weitere Informationen hier.
Ist Selenium Design Patterns and Best Practices als Online-PDF/ePub verfügbar?
Ja, du hast Zugang zu Selenium Design Patterns and Best Practices von Dima Kovalenko im PDF- und/oder ePub-Format sowie zu anderen beliebten Büchern aus Computer Science & Web Programming. Aus unserem Katalog stehen dir über 1 Million Bücher zur Verfügung.

Information

Jahr
2014
ISBN
9781783982707

Selenium Design Patterns and Best Practices


Table of Contents

Selenium Design Patterns and Best Practices
Credits
Foreword
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Writing the First Test
Choosing Selenium over other tools
Right tool for the right job
Price
Open source
Flexibility
The Record and Playback pattern
Advantages of the Record and Playback pattern
Disadvantages of the Record and Playback pattern
Getting started with the Selenium IDE
Installing the Selenium IDE
Recording our first test
Saving the test
Understanding Selenium commands
Reading Selenese
Comparing Ruby to Selenese
Comparing Selenium commands in multiple languages
Writing a Selenium test in Ruby
Introducing Test::Unit
Introducing asserts
Interactive test debugging
Summary
2. The Spaghetti Pattern
Introducing the Spaghetti pattern
Advantages of the Spaghetti pattern
Disadvantages of the Spaghetti pattern
Testing the product review functionality
Starting a product review test
Locating elements on the page
Using a browser's element inspector
Introducing locator strategies
Using advanced locator strategies
Using the absolute path
Using the relative path
Writing locator strategy code
Using chained selector strategy methods
Using the CSS selector
Using XPath
Implementing clicks and assertions
Duplicating the product review test
Reasons for failures
The Chain Linked pattern
The Big Ball of Mud pattern
Summary
3. Refactoring Tests
Refactoring tests
The DRY testing pattern
Advantages of the DRY testing pattern
Disadvantages of the DRY testing pattern
Moving code into a setup and teardown
Removing duplication with methods
Removing external test goals
Using a method to fill out the review form
Reviewing the refactored code
The Hermetic test pattern
Advantages of the Hermetic test pattern
Disadvantages of the Hermetic test pattern
Removing test-on-test dependence
Using timestamps as test data
Extracting the remaining common actions to methods
Creating a new review with a single method call
Reviewing the test-on-test dependency refactoring
Creating generic DRY methods
Refactoring with generic methods
The random run order principle
Advantages of the random run order principle
Disadvantages of the random run order principle
Summary
4. Data-driven Testing
Data relevance versus data accessibility
Hardcoding input data
Hiding test data from tests
Choosing the test environment
Introducing test fixtures
Parsing fixture data
Using fixture data in the tests
Using fixtures to validate products
Testing the remaining products
Multiple test models
A single test model
Implementing multiple test models
Making test failures more expressive
Using an API as a source of fixture data
Using data stubs
The default values pattern
Advantages of the default values pattern
Disadvantages of the default values pattern
Merging the default values pattern and the faker library
Implementing faker methods
Updating the comment test to use default values
Summary
5. Stabilizing the Tests
Engineering the culture of stability
Running fast and failing fast
Running as often as possible
Keeping a clean and consistent environment
Discarding bad code changes
Maintaining a stable test suite
Waiting for AJAX
Testing without AJAX delays
Using explicit delays to test AJAX forms
Implementing intelligent delays
Waiting for JavaScript animations
The Action Wrapper pattern
Advantages of the Action Wrapper pattern
Disadvantages of the Action Wrapper pattern
Implementing the Action Wrapper pattern
The Black Hole Proxy pattern
Advantages of the Black Hole Proxy pattern
Disadvantages of the Black Hole Proxy pattern
Implementing the Black Hole Proxy pattern
Test your tests!
Summary
6. Testing the Behavior
Behavior-driven Development
Advantages of BDD
Disadvantages of BDD
Testing the shopping cart behavior
Describing shopping cart behavior
Writing step definitions
Is BDD right for my project?
Introducing Cucumber
Feature files
Step definition files
The configuration directory
Cucumber.yml
env.rb
Running the Cucumber suite
The write once, test everywhere pattern
Advantages of the write once, test everywhere pattern
Disadvantages of the write once, test everywhere pattern
Testing a mobile site
Updating the Selenium wrapper
Moving step definition files
Updating the Cucumber profile and tagging tests
Running and fixing incompatible steps
Testing the purchase API
Summary
7. The Page Objects Pattern
Understanding objects
Describing a literal object
Object properties
Object actions
Objects within objects
Describing a programming object
Describing a web page with objects
The Page Objects pattern
Advantages of the Page Objects pattern
Disadvantages of the Page Objects pattern
Creating a Page Objects framework
Creating a page super class
Implementing sidebar objects
Implementing the Sidebar...

Inhaltsverzeichnis