Validate response status and content using condition block in Postman test script
Preconditions (2)
Step 1: Send a GET request to https://jsonplaceholder.typicode.com/posts/1
Step 2: In the Tests tab, write a condition block to check if the response status code is 200
Step 3: If status code is 200, assert that the response body contains a userId field with value 1
Step 4: If status code is not 200, assert that the response body contains an error message
✅ Expected Result: Test passes if status code is 200 and userId is 1; otherwise, test fails with appropriate error assertion