Validating a JSON respons for testing gives incorrect test passed result


I’m writing a test in Postman to check if my Get call returns a specific value in the json results. But the test is always ok no matter what the results in the json are.

This is my test:

pm.test("Browsestatus is completed", function () {
    var jsonData = JSON.parse(responseBody);
    pm.expect(jsonData.Internal.BrowseStatus) === ('failed');
pm.test("File is on disk", function () {
    var jsonData = JSON.parse(responseBody);
    pm.expect(jsonData.Internal.ArchiveStatus) === ("on_disk");
pm.test("OriginalStatus is completed", function () {
    var jsonData = JSON.parse(responseBody);
    pm.expect(jsonData.Internal.OriginalStatus) === ("completed");

this is my returned json:

“OriginalStatus”: “completed”,
“BrowseStatus”: “failed”,
“ArchiveStatus”: “failed”,

Anybody that can help?


Hey @edouard.verbeke,

Welcome and thank you for posting your question :star:

I can see a couple of areas in your tests that might be solved by taking a look through this doc on our learning site.

Also, that looks like a reduced output from the response as it seems to be missing some of the properties that you’re referencing in the tests.

correct, the output is reduced, this is the whole JSON:
(I’m reading your linked documents atm)

"Internal": {
    "MediaObjectId": "fc83600180ae4577abe557ca917b7d18f1c78d79d9b34482bc20f977fa6f0987",
    "FragmentId": "fc83600180ae4577abe557ca917b7d18f1c78d79d9b34482bc20f977fa6f098795bb55b975a1435f8a95d28197d1b51c",
    "OriginalStatus": "completed",
    "BrowseStatus": "failed",
    "ArchiveStatus": "failed",
    "UploadedById": "ff100b7a-efd0-44e3-8816-0905572421da",
    "OrganisationId": "100",
    "IngestSpaceId": "48969bab-ca82-4bed-9ecf-29e82ff5054f",
    "IsInIngestSpace": true,
    "IsFragment": false,
    "HasKeyframes": false,
    "ContainsGeoData": false,
    "PathToKeyframe": "",
    "PathToKeyframeThumb": "",
    "DepartmentId": null,
    "Browses": {},
    "PathToVideo": null
"Context": {
    "IsEditable": true,
    "IsDeletable": true,
    "IsPublic": true,
    "IsExportable": true


Thank you.

To me, that also doesn’t look like the whole response or it’s just the way it’s been formatted. :slight_smile:

It will make a big difference in your assertions (pm.expect()), if all the data is returned inside an array [...] - Just something to think about when you’re writing tests.

I’m leaving this here incase any beginners stumbles across this post.
Paste the below into the Tests tab in Postman:

// I've copied and paste the example JSON you sent me as a MOCK, so hitting the below URL will return the JSON your sent to me.
// This may need updating to match your response exactly, but basically you were writing your tests wrong ^_^
// Example MOCK URL:

var jsonData = pm.response.json();
pm.test("Response time is less than 1500", function() {

pm.test("Show File", function () {;

pm.test("Browsestatus is completed", function () {
    pm.expect(jsonData.Internal)"BrowseStatus", "failed");

// This one is puposely failing to prove that Postman is reporting failures.
pm.test("File is on disk", function () {
    pm.expect(jsonData.Internal)"ArchiveStatus", "on_disk");

pm.test("OriginalStatus is completed", function () {
    pm.expect(jsonData.Internal)"OriginalStatus", "completed");

Hi pfarrell,

Thank you so much! Works perfectly now! Have a nice day friendly person from the internet!!