If you haven't created your test request, refer Creating collections and test requests in postman.
For creating environment variable and access them in test requests, refer this link.
Now we have our collections ready. Let's see how to run them.
Add the following code in Tests tab of any request to check whether the HTTP status code 200.
pm.test("response is successfull",function(){
pm.response.to.have.status(200)
}
)
Now after executing the request, click send button to see the test is passed. You can check that under "Test Results" tab. You test is passed and the message you have in your code is reflected.
2. To execute a complete collection, click on the collection name, click Run button.
The following tab opens, you can select the number of requests needs to be executed and click Run button.
You can see the test results with Number of test case passed and failed. Also you can view Run Summary, and Console output and Export the results option.
3. To create Monitors, click on the collections name, You will see Monitors tab, on that click "Create a monitor" button.
If you haven't logged in yet, you will be redirected to this screen to login. If not you will directly moved to a tab to select the collection you want to execute in monitor.
In configuration tab, select the time duration you want your test to be executed in "Monitor run frequency" in postman server.
If you want, you can setup email notifications under additional preferences and click create.
Once you have created, you can see the web dashboard to see run results in web.
Thus we have learnt how to execute collection, create monitors and check web results.
Happy Testing!!!
Comments