Issue in ✅ Assignment #1. Please help me to understand

Hi everyone,

I’m learning API Automation currently in Valentino Artisan Coffee House API

I’m facing this issue of understanding the error in Assignment#1

" Get API status contains status 200 test | AssertionError: The request has no scripts.: expected undefined to be an array"

Please check the below code and try to explain as simple as you can

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).to.be.an('array', 'The request has no scripts.');
    let tests = request.event.find(event => event.listen === 'test');
    pm.expect(tests).to.be.an('object', 'The request has no test script.');
    pm.expect(tests.script.exec.toString(), 'check script').includes("pm.test");
    pm.expect(tests.script.exec.toString(), 'check script').includes("pm.response.to.have.status");
});

Thank you and I appreciate all the effort.

Hey @samessam :wave:

Could you share the Public Workspace where you’re doing this training please?

It will be easier to see where the problem might be.

1 Like

Hi Danny,

Please find the link below for the assignments my error is in assignment #1
in Test# 5

https://www.postman.com/valentins-team/workspace/test-automation-valentino-s-artisan-coffee-house-api/overview

Hey @samessam,

That’s a link to the actual course Workspace, do you have a link to your Public Workspace and the Collections that you have forked into there?

Hey Danny,

I have made my workspace public, Please find the link below.

https://www.postman.com/samessam/workspace/api-automation-testing/collection/28540506-becb35fa-6429-457a-9ab5-d4817eed0789?action=share&creator=28540506

Hi @vdespa,

Would you please share some guidance here. I appreciate your time and all the effort explaining

You don’t have a test created in the Get API status request under assignment 1.

These are the tasks for this assignment:

2 Likes

Thank you Danny for your support. I feel stupid. again I want to express my thanks.

No problems - We’re always here to help :heart:

Everything is easy when you know, I look at these all the time so it’s easier for me to see what could be wrong.

No questions are stupid and you shouldn’t feel like you are :pray:

Don’t hesitate to reach out to us again through the training!! :trophy:

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.