Question: Running A Single Operation From A Postman Collection Within A Folder
Closed this issue · 1 comments
Hi there,
I came across your library. Super work btw it's very similar to this library https://github.com/postmanlabs/newman.
I have a postman collection like the following:
Sample Postman Collection
Folder 1
Operation 1 Folder 1
Operation 2 Folder 1
Folder 2
Operation 1 Folder 2
Operation 2 Folder 2
My use case is that I generate a postman collection from the swagger file. I use a library to do that which generates a postman collection and an environment file. I overwrite the autogenerated environment file with one that was handcrafted as part of a manual test effort. The collection & environment file (that I replace) I send them onto this library to do some API testing
public void testRunPostman() throws Exception {
PostmanCollectionRunner cr = new PostmanCollectionRunner();
boolean isSuccessful = cr.runCollection(
"classpath:MyTestCollection.postman_collection",
"classpath:MyTestCollection.postman_environment",
"My use cases", false).isSuccessful();
Assert.assertTrue(isSuccessful);
}
Unfortunately, I don't have control over the content of the swagger file hence I'd like to be able to execute Operation 1 Folder 1
. In some cases I'd like to execute all operations within a folder or only just one from a folder. Would you have any suggestions on how to solve this? One solution would be to re-structure the swagger so that one operation is assigned to one folder but as mentioned above I don't have control of the content of the swagger document been sent to me. Many thanks in advance re any help with the above.
Closing this as the unit test in the project demonstrates that this can be done.