In Postman, you send a GET request to a valid API endpoint. What status code do you expect in the response for a successful request?
Think about the standard HTTP status code for success.
A 200 status code means the request was successful and the server returned the requested data.
You want to check if the JSON response body has a key named userId. Which test script is correct?
Use pm.expect with to.have.property to check keys in JSON.
Option B correctly uses pm.expect and to.have.property to assert the key exists.
When testing an API, you receive a 401 status code. What does this mean?
Think about authentication and permission errors.
A 401 status code means the client must authenticate to get the requested response.
Look at this test script:
pm.test('Check name', () => { pm.expect(pm.response.json().name).to.equal; });Why does it fail?
pm.test('Check name', () => { pm.expect(pm.response.json().name).to.equal; });Check the syntax of the assertion method.
The to.equal method requires an argument to compare against. Without it, the test throws an error.
You want to test an API with many input values without manually changing each request. Which Postman feature helps you do this?
Think about running many tests automatically with different inputs.
Collection Runner lets you run a set of requests multiple times using data files to vary inputs.