Skip to content

Instantly share code, notes, and snippets.

@PramodDutta
Created July 10, 2023 08:32
Show Gist options
  • Select an option

  • Save PramodDutta/e3542abf5df1a9f000e6c8494b1a24e1 to your computer and use it in GitHub Desktop.

Select an option

Save PramodDutta/e3542abf5df1a9f000e6c8494b1a24e1 to your computer and use it in GitHub Desktop.
API Test case.mb

Sure, here are 15 test cases in table format:

Test Case No Test Case Description Input Expected Output
1 Verify response for valid zip code api.zippopotam.us/IN/110001 200 OK, {"post code": "110001", "country": "India", "country abbreviation": "IN", "places": ... }
2 Verify response for invalid zip code api.zippopotam.us/IN/999999 404 Not Found
3 Verify response for invalid country abbreviation api.zippopotam.us/XYZ/110001 404 Not Found
4 Verify response for country with no zip code api.zippopotam.us/IN/ 400 Bad Request
5 Verify response for valid zip code, case insensitivity in country code api.zippopotam.us/in/110001 200 OK, {"post code": "110001", "country": "India", "country abbreviation": "IN", "places": ... }
6 Verify response with additional parameters (should be ignored) api.zippopotam.us/IN/110001?param1=test 200 OK, {"post code": "110001", "country": "India", "country abbreviation": "IN", "places": ... }
7 Verify response for special characters in zip code api.zippopotam.us/IN/1100%26%261 400 Bad Request
8 Verify response for zip code with spaces api.zippopotam.us/IN/1100 01 400 Bad Request
9 Verify response for zip code with leading zero api.zippopotam.us/IN/0110001 404 Not Found
10 Verify response for non-existent country api.zippopotam.us/XX/110001 404 Not Found
11 Verify response for country abbreviation longer than 2 letters api.zippopotam.us/IND/110001 404 Not Found
12 Verify response for no country and zip code api.zippopotam.us// 400 Bad Request
13 Verify response for zip code in path as a query parameter api.zippopotam.us/IN/?postcode=110001 400 Bad Request
14 Verify response for longer than expected zip code api.zippopotam.us/IN/110001123 404 Not Found
15 Verify response for valid zip code in another country api.zippopotam.us/US/110001 404 Not Found

Please note that the response codes and the responses can vary depending on the actual implementation of the API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment