A fully automated, end-to-end Postman collection for the SV College practice API.
Covers authentication, recommendations, comments, admin controls, cart management - and a clean teardown.
- Overview
- Collection Structure
- Bugs Found
- Environment Variables
- Running the Tests
- Test Strategy
- Clean Slate Principle
- Team Assignments
This collection was built directly from the live OpenAPI 3.1 spec (/openapi.json) and validates every documented endpoint across all authorization scopes | public, authenticated user, and admin.
Key design decisions:
- No hardcoded values. Every ID, token, and dynamic value is captured from prior responses and stored as an environment variable.
- Schema-accurate tests. Each assertion is written against the actual OpenAPI schemas (
UserOut,RecommendationOut,CommentOut, etc.), not assumed structures. - Negative tests included. Every team folder contains at least one negative test case (wrong credentials, missing auth, out-of-range values, invalid enums) | as required by the project spec.
- Clean teardown. The final folder deletes every resource created during the run and clears all auto-populated environment variables, leaving zero pollution for the next run.
π¦ SV Students Recommend | API Test Suite v3
β
βββ π Team 1 | Auth & Profile
β βββ β
Register New User POST /auth/register
β βββ β Register β Duplicate Email POST /auth/register [negative]
β βββ β Register β Missing Required Field POST /auth/register [negative]
β βββ β
Login β Get User Token POST /auth/login
β βββ β Login β Wrong Password POST /auth/login [negative]
β βββ β
Get My Profile GET /api/profile/me
β βββ β
Get Bearer Token GET /api/profile/token
β βββ β
Password Reset β Request Email POST /auth/recover
β βββ β
Change Password PUT /api/profile/password
β βββ β
Login After Password Change POST /auth/login
β
βββ π Team 4 | Admin β run before Teams 2 & 3 to get admin_token
β βββ β
Login β Get Admin Token POST /auth/login
β βββ β
Get All Users GET /api/admin/users
β βββ β Get All Users β Regular Token GET /api/admin/users [negative]
β βββ β
Ban User POST /api/admin/users/{id}/ban
β βββ β
Unban User POST /api/admin/users/{id}/unban
β βββ β
Get Admin Settings GET /api/admin/settings
β βββ β
Turn Off Recommendations PUT /api/admin/settings/recommendations_enabled
β βββ β
Turn On Recommendations PUT /api/admin/settings/recommendations_enabled
β
βββ π Team 2 | Recommendations
β βββ β
Get All Recommendations GET /api/recommendations
β βββ β
Get All β Filter by Category GET /api/recommendations?category=Movie
β βββ β
Create Recommendation POST /api/recommendations
β βββ β Create β No Token POST /api/recommendations [negative]
β βββ β
Get Recommendation by ID GET /api/recommendations/{id}
β βββ β Get β Non-Existent ID GET /api/recommendations/{id} [negative]
β βββ β
Update Recommendation PUT /api/recommendations/{id}
β βββ β Update β Invalid Category Enum PUT /api/recommendations/{id} [negative]
β
βββ π Team 3 | Comments & Blacklist
β βββ β
Get Comments for Recommendation GET /api/recommendations/{id}/comments
β βββ β
Add Comment POST /api/recommendations/{id}/comments
β βββ β Add Comment β Rating Out of Range POST /api/recommendations/{id}/comments [negative]
β βββ β Add Comment β No Auth POST /api/recommendations/{id}/comments [negative]
β βββ β
Get Blacklist GET /api/admin/blacklist
β βββ β
Add Email to Blacklist POST /api/admin/blacklist
β βββ β Add to Blacklist β Regular Token POST /api/admin/blacklist [negative]
β
βββ π Team 5 | Cart
β βββ β
Get Cart GET /api/cart
β βββ β
Add Item to Cart PUT /api/cart
β βββ β
Verify Cart Has Item GET /api/cart
β βββ β Get Cart β No Auth GET /api/cart [negative]
β βββ β
Clear Cart PUT /api/cart
β βββ β
Verify Cart Is Empty GET /api/cart
β
βββ π Teardown | Cleanup
βββ π§Ή Delete Comment DELETE /api/recommendations/{id}/comments/{id}
βββ π§Ή Delete Blacklist Entry DELETE /api/admin/blacklist/{entry_id}
βββ π§Ή Delete Recommendation DELETE /api/recommendations/{id}
βββ π§Ή Delete User Account DELETE /api/profile/me
Run order: Team 1 β Team 4 β Team 2 β Team 3 β Team 5 β Teardown
| Variable | Description | Example |
|---|---|---|
BaseURL |
Root URL of the API | https://sv-students-recommend.onrender.com |
name |
Display name for the test account | Test Student |
email |
Email for the test account (must be unique per run) | testuser@sv-test.dev |
password |
Password for the test account (min 4 chars) | TestPass1234! |
adminuser |
Admin account email | hagai@svcollege.co.il |
adminpass |
Admin account password | test1234 |
| Variable | Set by | Cleared by |
|---|---|---|
user_id |
Register New User | π§Ή Delete User Account |
testuser_token |
Login β Get User Token | π§Ή Delete User Account |
admin_token |
Login β Get Admin Token | *(persists |
rec_id |
Create Recommendation | π§Ή Delete Recommendation |
comment_id |
Add Comment | π§Ή Delete Comment |
blacklist_id |
Add Email to Blacklist | π§Ή Delete Blacklist Entry |
- Click Import and select both files:
API_testing_project.postman_collection.jsonEnvironment.json
- Select the
Environment.jsonfrom the environment dropdown (top right). - Fill in the six required variables (
BaseURL,name,email,password,adminuser,adminpass). - Right-click the collection β Run collection.
- Ensure Run folder by folder in order is enabled and click Run.
Ideal for CI/CD pipelines (GitHub Actions, Jenkins, GitLab CI).
# Install Newman
npm install -g newman
# Run the full suite
newman run API_testing_project.postman_collection.json \
-e Environment.json \
--env-var "email=testuser-$(date +%s)@sv-test.dev" \
--reporters cli,junit \
--reporter-junit-export results/report.xmlTip: Use
$(date +%s)or a UUID in the email to guarantee uniqueness across runs.
name: API Test Suite
on:
push:
branches: [main]
pull_request:
jobs:
api-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Newman
run: npm install -g newman
- name: Run Postman Collection
run: |
newman run API_testing_project.postman_collection.json \
-e Environment.json \
--env-var "email=ci-$(date +%s)@sv-test.dev" \
--env-var "BaseURL=${{ secrets.API_BASE_URL }}" \
--env-var "adminuser=${{ secrets.ADMIN_EMAIL }}" \
--env-var "adminpass=${{ secrets.ADMIN_PASS }}" \
--reporters cli,junit \
--reporter-junit-export results/report.xml
- name: Upload Test Report
uses: actions/upload-artifact@v4
if: always()
with:
name: newman-report
path: results/report.xmlStore sensitive values (adminuser, adminpass, etc.) as GitHub Secrets | never commit them to the repository.
Every request includes a minimum of 4 assertions in the Tests tab:
1. HTTP status code | exact match against the OpenAPI documented code
2. Response time | must be below 5 000 ms (accounts for cold-starts on Render's free tier)
3. Schema check | verifies that required fields exist and have the correct type
4. Data integrity | verifies that returned values match what was sent (e.g. returned email = sent email)
Negative tests additionally assert:
- That error status codes fall in the documented range (e.g.
422for validation errors,401for missing auth,403for insufficient privileges) - That
access_tokenis absent from error responses - That
detailis present inHTTPValidationErrorbodies
All console output follows the format:
[Request Name] STATUS_CODE | RESPONSE_TIME ms
A test run that does not clean up after itself is a failed test run | it pollutes the environment and causes false failures in subsequent runs.
This collection enforces clean slate via the Teardown folder, which:
- Deletes the comment (
DELETE /api/recommendations/{id}/comments/{comment_id}) - Deletes the blacklist entry (
DELETE /api/admin/blacklist/{blacklist_id}) - Deletes the recommendation (
DELETE /api/recommendations/{rec_id}) - Deletes the test user account (
DELETE /api/profile/me)
After each deletion the corresponding environment variable is unset via pm.environment.unset(...).
On a clean run, the final console message is:
β
====== CLEANUP COMPLETE β ENVIRONMENT IS CLEAN ====== β