Create automated tests to cover at least the CRUD (create, read, update, delete) operations on a pet store website
This test suite was designed to meet business requirements by createing automated test based on a swagger api: petstore.swagger.io
Postman is an API client that makes it easy for developers to create, share, test and document APIs. This is done by allowing users to create and save simple and complex HTTP/s requests, as well as read their responses.
This test suite is configured to be continuosly integrated in Travis for a fast pace development environment.
-
|--results
- PetStoreEnv.postman_collection.json = environment defined to run collection
- SwaggerPetStore.postman_collection.json = postman collection
|--tests:
Postman application is open source software, a Javascript application designed to load test functional behavior. Postman's features simplify each step of building an API and streamline collaboration so you can create better APIs—faster. The tool can be downloaded at: https://www.postman.com/downloads/
Postman test can be run from command line using node.js https://nodejs.org/es/
- Install Postman
- Double click to open postman
- In the top menu go to File > Import
- Locate in your local machine the file with the postman_collection extension
- Click on the gear in the right top "manage environments" and choose from your local machine the file with the environent extension
- Click on "Import" button
- There are two ways to send request: The first one is click on each request and then click button "send". The other one is to click button in the top menu "Runner"
- The first one is click on each request and then click button "send".
- The other one is to click button in the top menu "Runner", select the collection to run and the environment to be used and click button "Start Run". Within this option the number of iterations can be set up manually so the runner will be exceuted "n" times. This option also allows to add delays between each request.
- To run the testplan from the command line you need to open a command prompt of Node.js
- Traverse locally until folder where postman test are located
- Run the command: newman run with the following parameters:
- Parameters:
- - Path to the collection name
- - folder name to run (if applies)
- - environment to use
- - the last part is the one where you will store the report formatter (the formatter is located in this repo for your convenience)
finally the last part has the name of the html file where you will find the results of the test.
- Example: newman run C:\git\Projects\PetStore.postman_collection.json -e C:\git\Projects\environments\PetStore.postman_environment.json --delay-request 2000 --reporters cli,html --reporter-html-export PostmanResult.html
- Note: the postman files must have the extension .json in order to be used with newman, otherwise will not be recognized