Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
API Testing and Development with Postman

You're reading from   API Testing and Development with Postman A practical guide to creating, testing, and managing APIs for automated software testing

Arrow left icon
Product type Paperback
Published in May 2021
Publisher Packt
ISBN-13 9781800569201
Length 340 pages
Edition 1st Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
Dave Westerveld Dave Westerveld
Author Profile Icon Dave Westerveld
Dave Westerveld
Arrow right icon
View More author details
Toc

Table of Contents (19) Chapters Close

Preface 1. Section 1: API Testing Theory and Terminology
2. Chapter 1: API Terminology and Types FREE CHAPTER 3. Chapter 2: Principles of API Design 4. Chapter 3: OpenAPI and API Specifications 5. Chapter 4: Considerations for Good API Test Automation 6. Section 2: Using Postman When Working with an Existing API
7. Chapter 5: Understanding Authorization Options 8. Chapter 6: Creating Test Validation Scripts 9. Chapter 7: Data-Driven Testing 10. Chapter 8: Running API Tests in CI with Newman 11. Chapter 9: Monitoring APIs with Postman 12. Chapter 10: Testing an Existing API 13. Section 3: Using Postman to Develop an API
14. Chapter 11: Designing an API Specification 15. Chapter 12: Creating and Using a Mock Server in Postman 16. Chapter 13: Using Contract Testing to Verify an API 17. Chapter 14: Design and Create an API 18. Other Books You May Enjoy

Creating good mock responses

When we created the API specification as shown in the previous chapter, we added a few examples. Postman will attempt to use those examples along with the default values in the specification to create responses for your mock calls. However, the default stuff that Postman sets up will need to be customized a bit to our specific needs.

In this section, I will show you how to use Postman to create good mock responses. We will look at the following topics:

  • Using default examples
  • Creating your own custom examples
  • How to use dynamic variables in your examples
  • How to give different responses based on different path parameters
  • How Postman picks which example to return to you

This sounds like a lot, but we will work through it one step at a time and by the end of this section, you will have a good grasp of how to use examples in Postman to create useful mock responses. Let's start by looking at some of the default examples...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image