Add descriptions to API requests and verify documentation
Preconditions (2)
✅ Expected Result: The request description is saved and displayed correctly in the collection documentation
pm.test('Request description is present and correct', () => { const description = pm.request.description?.content || ''; pm.expect(description).to.not.be.empty; pm.expect(description).to.include('purpose'); // Replace 'purpose' with expected keyword in description });
This test script runs after the request execution in Postman.
It accesses the request's description content using pm.request.description.content.
First, it checks that the description is not empty to ensure documentation exists.
Then, it verifies the description includes an expected keyword or phrase to confirm correctness.
This helps keep request documentation accurate and visible in Postman collections.
Now add automated tests to verify descriptions for all requests in the collection
"Fetches user data by ID. Returns 404 if user not found."
Pass the test and this pattern moves unknown