pvarenik / rest_api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Test Cases for cat-facts API

Name Steps Expected Results Validations
Test Suite for GET /users/me
1. Healthy check with unauthorized user
Precondition: user is unauthorized
1. Send /users/me request Response: {"message":"Sign in first"} 1. Response should be a valid JSON
2. Response should be in correct user model and user endpoint description
3. Response should contain the message field with value "Sign in first"
4. HTTP status of the response should be 401
2. Healthy check with authorized user
Precondition: user is authorized
1. Send /users/me request Response: in documentation 1. Response should be a valid JSON
2. Response should be in correct fact model and fact endpoint description
3. Response should contain name.first, name.last and email fields with correct values
4. HTTP status of the response should be 200 or 304
3. Check /user request 1. Send /users request Response: Cannot GET /users/ 1. Response should be a valid HTML
2. Response should contain the correct message
4. HTTP status of the response should be 404
4. Check /users/me with different http methods
1. Send /users/me request with POST, PUT, PATCH, etc methods Response: Cannot /users/me 1. Response should be a valid HTML
2. Response should contain the correct message
4. HTTP status of the response should be 404
1. Response should be a valid HTML
5. Check /users/me with DELETE http methods
1. Send /users/me request with DELETE methods Response: User has been deleted 1. Response should be a valid JSON
2. Response should be in correct user model and user endpoint description
3. Response should contain the field message
4. HTTP status of the response should be 200 or 404
Test Suite for GET /facts
1. Healthy check GET /facts/random 1. Send /facts/random?animal_type=cat&amount=2 Response: two facts about the cats 1. Response should be a valid JSON
2. Response should be in correct fact model and fact endpoint description
3. Response should contain contain two elements
4. HTTP status of the response should be 200
2. Healthy check GET /facts/:factID 1. Send /facts/591f98803b90f7150a19c229 Response: /facts/591f98803b90f7150a19c229s 1. Response should be a valid JSON
2. Response should be in correct fact model and fact endpoint description
3. Response should contain contain fact with id 591f98803b90f7150a19c229
4. HTTP status of the response should be 200
3. Healthy check GET /facts/ 1. Send /facts?animal_type=cat,horse Response: An array of Facts for cat and horse 1. Response should be a valid JSON
2. Response should be in correct fact model and fact endpoint description
3. Response should contain contain array facts for the cat and horse
4. HTTP status of the response should be 200
4. Healthy check GET /facts/me 1. Send /facts/me?animal_type=cat,horse Response: An array of Facts that the authenticated user has submitted. 1. Response should be a valid JSON
2. Response should be in correct fact model and fact endpoint description
3. Response should contain contain array facts submitted by the current user for the cat and horse
4. HTTP status of the response should be 200
5. Check all the enpoints above with different http methods
1. Send /facts/ request with POST, PUT, PATCH, etc methods Response: Cannot /fact/ 1. Response should be a valid HTML
2. Response should contain the correct message
4. HTTP status of the response should be 404
1. Response should be a valid HTML

About

License:MIT License