Selenium Design Patterns and Best Practices
eBook - ePub

Selenium Design Patterns and Best Practices

Dima Kovalenko

Partager le livre
  1. 270 pages
  2. English
  3. ePUB (adapté aux mobiles)
  4. Disponible sur iOS et Android
eBook - ePub

Selenium Design Patterns and Best Practices

Dima Kovalenko

DĂ©tails du livre
Aperçu du livre
Table des matiĂšres
Citations

À propos de ce livre

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.

Foire aux questions

Comment puis-je résilier mon abonnement ?
Il vous suffit de vous rendre dans la section compte dans paramĂštres et de cliquer sur « RĂ©silier l’abonnement ». C’est aussi simple que cela ! Une fois que vous aurez rĂ©siliĂ© votre abonnement, il restera actif pour le reste de la pĂ©riode pour laquelle vous avez payĂ©. DĂ©couvrez-en plus ici.
Puis-je / comment puis-je télécharger des livres ?
Pour le moment, tous nos livres en format ePub adaptĂ©s aux mobiles peuvent ĂȘtre tĂ©lĂ©chargĂ©s via l’application. La plupart de nos PDF sont Ă©galement disponibles en tĂ©lĂ©chargement et les autres seront tĂ©lĂ©chargeables trĂšs prochainement. DĂ©couvrez-en plus ici.
Quelle est la différence entre les formules tarifaires ?
Les deux abonnements vous donnent un accĂšs complet Ă  la bibliothĂšque et Ă  toutes les fonctionnalitĂ©s de Perlego. Les seules diffĂ©rences sont les tarifs ainsi que la pĂ©riode d’abonnement : avec l’abonnement annuel, vous Ă©conomiserez environ 30 % par rapport Ă  12 mois d’abonnement mensuel.
Qu’est-ce que Perlego ?
Nous sommes un service d’abonnement Ă  des ouvrages universitaires en ligne, oĂč vous pouvez accĂ©der Ă  toute une bibliothĂšque pour un prix infĂ©rieur Ă  celui d’un seul livre par mois. Avec plus d’un million de livres sur plus de 1 000 sujets, nous avons ce qu’il vous faut ! DĂ©couvrez-en plus ici.
Prenez-vous en charge la synthÚse vocale ?
Recherchez le symbole Écouter sur votre prochain livre pour voir si vous pouvez l’écouter. L’outil Écouter lit le texte Ă  haute voix pour vous, en surlignant le passage qui est en cours de lecture. Vous pouvez le mettre sur pause, l’accĂ©lĂ©rer ou le ralentir. DĂ©couvrez-en plus ici.
Est-ce que Selenium Design Patterns and Best Practices est un PDF/ePUB en ligne ?
Oui, vous pouvez accĂ©der Ă  Selenium Design Patterns and Best Practices par Dima Kovalenko en format PDF et/ou ePUB ainsi qu’à d’autres livres populaires dans Computer Science et Web Programming. Nous disposons de plus d’un million d’ouvrages Ă  dĂ©couvrir dans notre catalogue.

Informations

Année
2014
ISBN
9781783982707
Édition
1
Sous-sujet
Web Programming

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...

Table des matiĂšres