Postman is a Chrome App. This means that Postman can only run on the Chrome browser.
Postman is a powerful API testing tool. By using this tool, we can easily test our API’s. With postman, we can construct request quickly, save them as collections for later use. Please refer the figure 1.0.
Figure 1.0 - POSTMAN
How to add POSTMAN to chrome browser
1.Launch the Chrome browser.
2.Type the "Postman Chrome" in the address bar field.
3.Click the first search result.
4.In the postman home page, click the "Add to Chrome" button.
Learn about Collection:
A collection allows you to group individual requests together. These requests can be further organized into folders to accurately mirror your API. Please refer the figure 1.1, 1.2 & 1.3.
The collection runner runs requests in a collection in the order in which you set them. It also runs tests for every request and gives you an aggregate summary of what happened. It stores all your test runs so you can compare them and see what has changed.
All you have to do is select a collection, an environment if needed, and hit the Start Test button. Optionally, you can also add a CSV or a JSON file from which Postman can pick up data values.Please refer the figure 1.4 & 1.5.
If you want to run your request as a collection, we have to purchase jet-packs. It costs 9.99 dollars.
Jetpacks are awesome upgrades, which will make our API workflow faster and more efficient.
Once you activate the Jetpacks upgrade, you get the following features:
1. Test editor and runner: Lets you write and run tests within Postman.
2. Collection runner: Lets you run an entire Postman collection in one go.
3. Data variables: Let’s you parameterize requests with values from a JSON/CSV file. This makes testing multiple scenarios as easy as adding another row to a spreadsheet.A one-time initialization is required. All future updates will be free.
Figure 1.1 - Create Collection
Figure 1.2 - Add Folder to the Collection
Figure 1.3 - Added Folders into the Collection
|
Figure 1.4 - Collection Runner |
Figure 1.5 - Test Result
Learn about Environment:
While working with APIs, you will often need to have different setups. Environments give you the ability to customize requests using variables. This way you can easily switch between different setups without changing your requests.Environments can be downloaded and saved as JSON files and uploaded later.
Each environment is a set of key-value pairs. These can be edited using the key-value editor. The key is the variable name.
Variables can be used in the following form - {{variable Name}}. The string {{variable Name}} will be replaced with its corresponding value. For example, for an environment variable 'URL' with the value 'http://localhost’, you will have to use {{url}} in the request URL field. {{url}} will be replaced by http://localhost when the request is sent. Please refer the figure 1.6 & 1.7.
Figure 1.6 - Add Environment
Figure 1.7 - Select Environment
Learn about Newman:
Newman is a command-line collection runner for Postman. It allows you to run and test a Postman collection directly from the command-line.Newman is built on Node.js. To run Newman, make sure you have Node.js & python installed.
By using the below commands, we can easily install the newman & run the postman collection directly from the command-line on our machine.
npm install -g newman
newman -c mycollection.json –n 10 –e environment variable –H report.html
d data.json
-c Specify a Postman collection as a JSON [file]
-e Specify a Postman environment as a JSON [file]
-n Define the number of iterations to run
-H Export a HTML report to a specified file
-d Specify a data file to use either json or csv