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

Testing the purchase API


Modern websites have started to include public API endpoints. These are used as a communication portal between native mobile phone applications and the core website, amongst other things. Many companies build their whole business on providing a public API. Testing the publicly accessible API is just as critical as testing the main website. After all, if the API breaks, than all of the third-party applications that consume it will stop working, thus preventing users from giving us money.

Our website provides several public API endpoints to allow third-party integration. One of these endpoints allows the purchase of a given product. By sending a POST request with some customer information, we can purchase products from a mobile phone app or a web portal embedded on some other website.

We have several options when it comes to testing our API. For example, we can write a simple shell script that will make a curl or wget request against the API endpoint and perform a simple...