Book Image

Selenium Design Patterns and Best Practices

By : Dima Kovalenko
Book Image

Selenium Design Patterns and Best Practices

By: Dima Kovalenko

Overview of this book

Table of Contents (18 chapters)
Selenium Design Patterns and Best Practices
Credits
Foreword
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Using data stubs


Modern websites are incredibly complicated and combine many external services. Most e-commerce websites do not actually process the credit cards themselves. Instead, the payment information is passed on to the bank, and the bank tells the website whether the transaction is successful.

Getting all of the external services running is a difficult task, especially if the service our website is using is also being developed at the same time as our project. We cannot afford to wait until all of the services are completely written and integrated to start writing our tests. So, we have to stub some of the services until they are fully developed.

Stubs are premade responses to our application's requests. Stub responses are formatted and look like real responses, but they don't actually do any work. For example, the API endpoint we used to write our test does not actually communicate with the database. Instead, it responds with a premade JSON file. Stubbing the application is a great...