I tried searching if someone else had this issue but no luck. I’m having an issue with completing an assignment as shown in this workspace. The tests I wrote definitely worked but when I check my solution I get this error in the test suite.
The assignment is to write a test that checks if the API returned status code 200. Here’s what it looks like.
I love the way that course is basically cribbed from the Postman Learning Centre courses, including the “If you have any failures, review the failed test results or ask for support in the community forum”.
Anyways, if you look at the failing test. It does a few things.
pm.test("Get API status contains status 200 test", () => {
let request = folder.item.find(req => {return req.name === "Get API status"})
pm.expect(request.event[0].script.exec.toString(), 'check script').includes("pm.test");
pm.expect(request.event[0].script.exec.toString(), 'check script').includes("pm.response.to.have.status");
});
The error is showing 'expected " to include ‘pm.test’".
This part is basically the tests tab for the request.
request.event[0].script.exec.toString()
I suspect the issue is that its can’t find the request name.
Do you have a request called “Get API status”. (Which will be case sensitive).