Authentication testing ensures that only valid users can access the API. What is the main reason this protects the API?
Think about what happens if someone who shouldn't access the API tries to do so.
Authentication testing confirms that only users with valid credentials can use the API, protecting sensitive information and operations from unauthorized access.
Given this Postman test script that checks for a valid token in the response header, what will be the test result?
pm.test('Token is present', function () { pm.response.to.have.header('Authorization'); });
Look at what the test is checking in the response.
The test checks if the response headers include 'Authorization'. If yes, the test passes.
You want to confirm that an API returns a 401 status code when authentication fails. Which assertion is correct?
Check the Postman syntax for status code assertions.
Option A uses the correct Postman assertion method to check the status code.
Consider this test script meant to check if the 'Authorization' header is missing. Why does it fail even when the header is absent?
pm.test('Authorization header missing', function () { pm.expect(pm.response.headers.get('Authorization')).to.not.be.null; });
Look carefully at what the test expects about the header's presence.
The test expects the header to exist (not null), so it fails when the header is missing, which is the opposite of the intended check.
You want to verify that the 'Authorization' header contains a JWT token with three parts separated by dots. Which script correctly tests this?
JWT tokens have three parts separated by two dots.
JWT tokens have three parts separated by dots, so splitting by '.' should give length 3.