|
1 | | -# azure-devops-rest-api |
2 | | -Automating a Postman test suite using Newman and Azure DevOps |
| 1 | +# Walkthrough: Automating REST API tests using Postman and Azure DevOps |
| 2 | +## Overview |
| 3 | +This walkthrough will take you through creating and automating some REST API tests using Postman and Azure DevOps. For this walkthrough, we'll be making use of HSBC's excellent (and public) branch locator API, which you can find here: https://api.hsbc.com/branch-locator.html. We assume you are comfortable creating basic API calls with Postman. |
| 4 | + |
| 5 | +We're going to do the following: |
| 6 | +1. Create some API calls |
| 7 | +2. Write some tests against them |
| 8 | +3. Create an Azure DevOps Release pipeline to automate these tests |
| 9 | +## Prerequisites |
| 10 | +* You must have installed the latest version of Postman App (https://www.postman.com/downloads/) |
| 11 | +* You must have created a free account with Azure DevOps Services (https://azure.microsoft.com/en-gb/services/devops/) |
| 12 | +* You must be |
| 13 | +* You must be able to access the API above |
| 14 | +## Creating the API calls |
| 15 | +(If you don't want to create your own API calls, we've saved our own collection [here](https://github.com/bendalby82/azure-devops-rest-api/blob/master/postman/HSBC.postman_collection.json), which you can just import into Postman) |
| 16 | +1. Create a new Collection in Postman, and set a variable called `hostname` with initial value `api.hsbc.com` |
| 17 | + |
| 18 | +2. Under that Collection, create some test API calls against the API - you can see my choices in the screenshot below, including my use of that hostname collection variable: |
| 19 | + |
| 20 | + |
| 21 | +3. Check your API requests are functioning and green, even though there aren't any tests: |
| 22 | + |
| 23 | + |
| 24 | +## Write some tests against them |
| 25 | +1. Postman has excellent documentation on how to write tests [here](https://github.com/bendalby82/azure-devops-rest-api/blob/master/images/02-Basic-Requests-Are-All-Green.png) - but we want a nice mixture of performance tests, status tests and data tests. Note the use of the requestName property, which will make our tests easier to read further down the line: |
| 26 | + |
| 27 | + |
| 28 | +2. Make sure all of our requests have at least some tests against them: |
| 29 | + |
0 commit comments