I was trying to validate some of the testcases but it says "There was an error in evaluating the test script: SyntaxError: Invalid or unexpected token"

Not sure where you have copied that from but it’s the older test syntax.

Also, the formatting has changed all the double quotes, the red underlined sections is showing you this.

Look at the difference between the tests on the first lines, the middle one is the only correctly formated one.

As danny mentioned , just press control + f and replace all quotes to correct quotes

1 Like

Thank you, it was solved

Glad to see you have it working @maintenance-candida2 - I would also suggest changing the test syntax to the newer version.

Something like this:

let jsonData = pm.response.json();

pm.test("Verify the status code is 200", function () {
    pm.response.to.have.status(200);
});

pm.test("Verify the firstname", function () {
    pm.expect(jsonData.data[0].first_name).to.eql("Michael");
});

pm.test("Verify response body has the data property", function () {
    pm.expect(jsonData).to.haveOwnProperty("data");
});

pm.test("Verify Page Number", function () {
    pm.expect(jsonData.page).to.eql(2);
});

More information can be found here in the learning center:

2 Likes