Selenium Design Patterns and Best Practices
eBook - ePub

Selenium Design Patterns and Best Practices

Dima Kovalenko

Compartir libro
  1. 270 páginas
  2. English
  3. ePUB (apto para móviles)
  4. Disponible en iOS y Android
eBook - ePub

Selenium Design Patterns and Best Practices

Dima Kovalenko

Detalles del libro
Vista previa del libro
Índice
Citas

Información del libro

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.

Preguntas frecuentes

¿Cómo cancelo mi suscripción?
Simplemente, dirígete a la sección ajustes de la cuenta y haz clic en «Cancelar suscripción». Así de sencillo. Después de cancelar tu suscripción, esta permanecerá activa el tiempo restante que hayas pagado. Obtén más información aquí.
¿Cómo descargo los libros?
Por el momento, todos nuestros libros ePub adaptables a dispositivos móviles se pueden descargar a través de la aplicación. La mayor parte de nuestros PDF también se puede descargar y ya estamos trabajando para que el resto también sea descargable. Obtén más información aquí.
¿En qué se diferencian los planes de precios?
Ambos planes te permiten acceder por completo a la biblioteca y a todas las funciones de Perlego. Las únicas diferencias son el precio y el período de suscripción: con el plan anual ahorrarás en torno a un 30 % en comparación con 12 meses de un plan mensual.
¿Qué es Perlego?
Somos un servicio de suscripción de libros de texto en línea que te permite acceder a toda una biblioteca en línea por menos de lo que cuesta un libro al mes. Con más de un millón de libros sobre más de 1000 categorías, ¡tenemos todo lo que necesitas! Obtén más información aquí.
¿Perlego ofrece la función de texto a voz?
Busca el símbolo de lectura en voz alta en tu próximo libro para ver si puedes escucharlo. La herramienta de lectura en voz alta lee el texto en voz alta por ti, resaltando el texto a medida que se lee. Puedes pausarla, acelerarla y ralentizarla. Obtén más información aquí.
¿Es Selenium Design Patterns and Best Practices un PDF/ePUB en línea?
Sí, puedes acceder a Selenium Design Patterns and Best Practices de Dima Kovalenko en formato PDF o ePUB, así como a otros libros populares de Computer Science y Web Programming. Tenemos más de un millón de libros disponibles en nuestro catálogo para que explores.

Información

Año
2014
ISBN
9781783982707
Edición
1
Categoría
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...

Índice