I am attempting to display an actual value from an API call ‘Body response’ and also a ‘Headers’ item in test results.
I can interrogate both by const response = pm.response.json() and pm.response.headers.get… and display them using console.log but is there a way to display the actual values in test results ?
For example, I might get number of items = 4 in the body response. I can get the value of ‘4’ printed in console.log but how do I get a test result to display ‘4’. Similarly, a ‘correlation id’ is displayed in ‘Headers’, can I get this displayed in test results, not just in console.log.
Hi Danny, to give a bit of background, I have a test collection (launched manually) which includes over 100 tests.
At the end of the run I need to export the results which, as they only include high level information (by default), don’t include some data I need such as ‘header’ information.
If I can get the data within the test results themselves then it would be displayed in the report/export.
A test could just be a simple GET call resulting in total number response, the first part of the body response being;
{
"resultCount": 1; etc
}
The same test will have an ID within the ‘Headers’ tab;
Key: Request-Id Value: xxxxxxxxxxxxxxxxxxxxxxx
I can parse the responses, confirm the resultcount is a number etc etc and I can also convert the request-id to an environment variable.
What I wan to be able to do is DISPLAY both results in test results so they will then be included in the test run export at the end of the run.
Hi Danny, thanks for the response, I just need the actual results displaying within the Test Results tab not just confirmtaion that a result exists e.g. PASS Result count = 1 in the above example
I can get both values to be displayed in the console.log so I would have thought the same result could be displayed in the test results themselves, that’s my logic anyway