Call reporting API after each test

Hi -
I have a reporting tool which can gather data for all my test runs and display historical trends, for this I need to call an API after each postman test runs to push data into that tool. Any pointers on how I can probably create a single request to push this data but be able to call it after each test on my request? I thought about setnextrequest but if my API calls are in a workflow that might impact the flow.

Would adding a pm.sendRequest from each test work?

Hi !

While I have never used pm.sendRequest yet, It think it would work. Does your reporting tool allow to send data after the tests have been executed ? This would allow you to send all the data in one request

I can send data either all at once or in real time. I am able to use sendRequest but the problem is my collection will have many tests and now if i use newman run I need to find a way to get run summary to be able to then push it to the reporting tool. I came across runsummary object but still trying to find out how to use it, documentation is sparse on that.

Sorry, I cannot help you on that :confused:

I would assume here that your ultimate goal is automation with newman.

The cleanest way of handling this would be to write your own newman reporter which can publish the results to where they are needed.

Anything outside of this solution is just a mess to maintain.

1 Like

Thank you! I was able to resolve it by using pm.request but its not graceful, I have to put that function in every request and make call based on pass or fail condition. Its not scalable for sure. I’ll look into writing my own reporter.