How can I extract the pass/fail tests results

I want to extract the evaluation results of the tests into an environment variable. This is displayed in the UI as a green box with the test “PASS”, or red with “FAIL”.
App details: Postman App 5.5, IOS 10

1 Like

@testmonger Not yet. What’s your use-case?

You can use something like this after all your expect statements:
pm.environment.set("TEST - test name", true);

If an assertion failed, this will never be executed, and the value will not be set:

pm.test("response should be okay", function () {;"");"error"); 
    pm.environment.set("TEST - response should be okay", "TRUE");

Hope this helps


Great suggestion abhijit. I would prefer to add the code in a reusable manner, so I will try to implement this at the folder or collection level. I’ve also wondered about creating functions that could be called from any script, perhaps as a library or extension of the SDK. I’m not a programmer, but would like to explore these kinds of options to extend Postman.

My use case is that as a Postman user I want to create or update Test Case issues in JIRA with selected details and test results from each request when executing a Postman Collection Runner. Ideally, I would like to set a flag for each request to signify whether to create/update JIRA (perhaps implemented as a data file for the runner). Also, I would prefer minimize or avoid adding additional code in each request in order to support the JIRA integration.

Were you able to figure this out? I need solution for this as well.