Scenario‘s position in the API automation testing
Typical transactions selection -> Corresponding API selection -> Scripting -> Scenarios and reports(I’m here) -> CICD
Typical transactions selection
Typical transactions selection refers to: Trade Me-2-typical transactions
Corresponding API selection and scripting
Corresponding API selection and scripting refers to:
Trade Me-3-Retrieve general categories API testing
Trade Me-4-Retrieve your watchlist API testing
Trade Me-5-Remove a listing from your watchlist API testing
Trade Me-6-Retrieve closing soon listings API testing
Trade Me-7-Add a listing to your watchlist API testing
Trade Me-8-Retrieve your won items API testing
Trade Me-9-Remove a purchase from your won items list API testing
Trade Me-10-General search API testing
Trade Me-11-Retrieve the details of a single listing API testing
Trade Me-12-Buy an auction using Buy Now API testing
Two ways of running your scenarios
Postman uses the concept of collection to store your API testing scripts as a basic scenario.
You could choose two ways to run the scenario and display the running report.
One is by the collection runner, and another is the ‘Newman’ tool.
Run your scenarios by the collection runner
-
What is the postman collection runner
The Collection Runner allows you to run sets of requests in a specified sequence.
The Collection Runner will log your request test results, and your scripts can pass data between requests as well as altering the request workflow.
More refer to official doc: Using the Collection Runner .
-
Go to the collection runner label
-
Enable ‘Show Postman Console’
View > Show Postman Console to enable the console log
-
Set running order, iterations, parametric data files, then click the ‘Run collection’ button
-
See reports from Postman in-build ‘View Results’
-
See running results from console log
Run your scenarios by ‘Newman’
-
What is the Newman
Newman is a command-line collection runner for Postman.
It allows you to effortlessly run and test a Postman collection directly from the command-line.
It is built with extensibility in mind so that you can easily integrate it with your continuous integration servers and build systems.
More refer to: newman GitHub
-
How to install the Newman?
How to install the Newman refers to: How to install Newman?
-
Export collection files to local
Right click given collection -> Export -> single click ‘Collection v2.1 (recommended)’ -> Export -> choose a local directory to store the collection file.
This demo stores to local D:\Software\postman\collections
Will have both positive and negative case scripts to be exported to local
Positive and negative case scripts name as ‘tradeMeSandBox.postman_collection.json’ and ‘tradeMeSandBox-Negative.postman_collection.json’.
-
Export environment parameter file to local
Click specific environment the ‘Edit’ -> Export -> choose a local directory to store the environment file.
This demo stores to local D:\Software\postman\data
-
Generate cli and html report
Using Newman reporters to generate both command line and web page reports.
The grammar refers to Reporters .
-
See cli and html report details