I am looking for an endpoint that can run all the test cases I have created in postman
Is it possible?
I am not looking for the option of monitoring as I have already tried that but that’s not a good approach
I am looking for an endpoint that can run all the test cases I have created in postman
Is it possible?
I am not looking for the option of monitoring as I have already tried that but that’s not a good approach
Basically I can use monitors but the case is that I can’t use it because I have to create a monitor for every collection
I wanted to know if there’s an endpoint to run all the test cases in a collection
@jalib.khan I don’t think we support this feature. In Postman you can only run tests inside one collection and for that either you can use Postman Runner, Newman or Monitors.
You can run all the tests inside a collection by using the Postman Pro API with Newman.
https://docs.api.getpostman.com/
You’ll need to create a Postman Pro API Key in order to use this.
So, I can type in the below into a command terminal (or create a .bat file which will run the tests upon double clicking it)
newman run "https://api.getpostman.com/collections/{{putYourTestCollectionIDHere}}/?apikey={{postmanProAPIKeyGoesHere}}" --environment "https://api.getpostman.com/environments/{{putYourEnvironmentIDHere}/?apikey={{postmanProAPIKeyGoesHere}}"
This way, you can also trigger the running of your tests in your build tool (TeamCity, Jenkins, TravisCI etc.)
@postman-paul540 That is a great answer.
To add on to that, you could probably arrange similar collections in a workspace in Postman to help you segregate which collections to run at a time.
So let’s say you have a Project X
, and all collections related to that project are in a workspace. You could then use the Postman API, to fetch that individual workspace. Here’s what the response looks like:
{
"workspace": {
"id": "f8801e9e-03a4-4c7b-b31e-5db5cd771696",
"name": "Demo workspace",
"type": "personal",
"description": "Demos.",
"collections": [
{
"id": "7c31b469-bd43-4411-9283-6d397855ee0e",
"name": "Mock demo - collection",
"uid": "1234-7c31b469-bd43-4411-9283-6d397855ee0e"
},
{
"id": "356fe068-a0f8-4f31-b34d-d12149eac681",
"name": "Mock demo - response code",
"uid": "1234-356fe068-a0f8-4f31-b34d-d12149eac681"
}
],
"environments": [
{
"id": "423fd955-a9c8-47cd-9ab0-09a6a575c4be",
"name": "Mock demo - CNX",
"uid": "1234-423fd955-a9c8-47cd-9ab0-09a6a575c4be"
},
{
"id": "24c45c84-5147-4c15-bb9a-c3186b81d3cc",
"name": "Mock Demo - response code",
"uid": "1234-24c45c84-5147-4c15-bb9a-c3186b81d3cc"
}
]
}
}
You could then iterate over the workspace.collections
array to run all those collections by extracting the id from there.
Hope this helps.