0% found this document useful (0 votes)
2 views16 pages

API Testing Documentation

This document details the API testing for the DMC SaaS platform, including authentication, itinerary, booking, and supplier endpoints. All 15 tests executed using Postman passed, resulting in a 100% pass rate, with key findings highlighting correct HTTP status codes and effective error handling. The document includes specific test cases, expected responses, and validation checks for each endpoint.

Uploaded by

Kabir Khadka
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views16 pages

API Testing Documentation

This document details the API testing for the DMC SaaS platform, including authentication, itinerary, booking, and supplier endpoints. All 15 tests executed using Postman passed, resulting in a 100% pass rate, with key findings highlighting correct HTTP status codes and effective error handling. The document includes specific test cases, expected responses, and validation checks for each endpoint.

Uploaded by

Kabir Khadka
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

API Testing Documentation

DMC SaaS Platform - REST API Test Collection

Version 1.0
January 29, 2026
Prepared by: QA Engineer
1. Introduction
This document provides comprehensive API testing documentation for the DMC SaaS
platform. All tests have been executed using Postman and can be imported into any API
testing tool.

1.1 Base URL


QA Environment: [Link]
Prod Environment: [Link]

1.2 Authentication
Most endpoints require Bearer token authentication. Obtain a token by calling the
/auth/login endpoint:
POST /api/v1/auth/login
Content-Type: application/json

{
"username": "agent@[Link]",
"password": "your_password"
}

Response:
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiresIn": 3600
}

Use the token in subsequent requests:


Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
2. Authentication Endpoints

2.1 POST /auth/login - Successful Login


Test ID: API_AUTH_001

Priority: Critical

Request:
POST /api/v1/auth/login
Content-Type: application/json

{
"username": "agent@[Link]",
"password": "Test123!"
}

Expected Response: 200 OK


{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"user": {
"id": "USR_001",
"username": "agent@[Link]",
"role": "travel_agent",
"firstName": "John",
"lastName": "Doe"
},
"expiresIn": 3600
}

Validation Checks:

✓ Status code is 200


✓ Response contains valid JWT token

✓ Token expires in 3600 seconds (1 hour)


✓ User object contains required fields



Test Result: PASS


2.2 POST /auth/login - Invalid Credentials
Test ID: API_AUTH_002

Priority: High

Request:
POST /api/v1/auth/login
Content-Type: application/json

{
"username": "invalid@[Link]",
"password": "wrongpassword"
}

Expected Response: 401 Unauthorized


{
"error": "Unauthorized",
"message": "Invalid credentials",
"timestamp": "2026-01-29T10:30:00Z"
}

Validation Checks:

✓ Status code is 401


✓ Error message is clear and informative

✓ No sensitive information leaked



Test Result: PASS


3. Itinerary Endpoints

3.1 GET /itineraries - List All Itineraries


Test ID: API_ITN_001

Priority: High

Request:
GET /api/v1/itineraries?page=1&limit=10
Authorization: Bearer {token}

Expected Response: 200 OK


{
"data": [
{
"id": "ITN_001",
"clientId": "CLI_123",
"destination": "Paris",
"startDate": "2026-06-01",
"endDate": "2026-06-07",
"status": "confirmed",
"createdAt": "2026-01-15T10:00:00Z"
}
],
"pagination": {
"total": 50,
"page": 1,
"limit": 10,
"totalPages": 5
}
}

Validation Checks:

✓ Status code is 200


✓ Data array contains itinerary objects

✓ Pagination object is correct


✓ Each itinerary has required fields



Test Result: PASS


3.2 POST /itineraries - Create New Itinerary
Test ID: API_ITN_002

Priority: Critical

Request:
POST /api/v1/itineraries
Authorization: Bearer {token}
Content-Type: application/json

{
"clientId": "CLI_123",
"destination": "Rome",
"startDate": "2026-08-01",
"endDate": "2026-08-08",
"numberOfGuests": 2,
"notes": "Anniversary trip"
}

Expected Response: 201 Created


{
"id": "ITN_456",
"clientId": "CLI_123",
"destination": "Rome",
"startDate": "2026-08-01",
"endDate": "2026-08-08",
"numberOfGuests": 2,
"status": "draft",
"notes": "Anniversary trip",
"createdAt": "2026-01-29T11:00:00Z",
"createdBy": "USR_001"
}

Validation Checks:

✓ Status code is 201


✓ ID is generated and returned

✓ Default status is "draft"


✓ createdAt timestamp is present


✓ createdBy reflects authenticated user



Test Result: PASS


3.3 GET /itineraries/{id} - Get Single Itinerary
Test ID: API_ITN_003

Priority: High

Request:
GET /api/v1/itineraries/ITN_001
Authorization: Bearer {token}

Expected Response: 200 OK


{
"id": "ITN_001",
"clientId": "CLI_123",
"client": {
"id": "CLI_123",
"name": "John Smith",
"email": "john@[Link]"
},
"destination": "Paris",
"startDate": "2026-06-01",
"endDate": "2026-06-07",
"numberOfGuests": 2,
"status": "confirmed",
"bookings": [
{
"id": "BKG_789",
"supplierId": "SUP_456",
"type": "hotel",
"status": "confirmed"
}
],
"totalCost": 2500.00,
"currency": "USD"
}

Validation Checks:

✓ Status code is 200


✓ Itinerary details are complete

✓ Client object is populated


✓ Bookings array is included



Test Result: PASS


3.4 PUT /itineraries/{id} - Update Itinerary
Test ID: API_ITN_004

Priority: High

Request:
PUT /api/v1/itineraries/ITN_001
Authorization: Bearer {token}
Content-Type: application/json

{
"destination": "Paris & Lyon",
"endDate": "2026-06-09",
"notes": "Extended trip to include Lyon"
}

Expected Response: 200 OK


{
"id": "ITN_001",
"destination": "Paris & Lyon",
"endDate": "2026-06-09",
"notes": "Extended trip to include Lyon",
"updatedAt": "2026-01-29T12:00:00Z",
"updatedBy": "USR_001"
}

Validation Checks:

✓ Status code is 200


✓ Only specified fields are updated

✓ updatedAt timestamp is updated


✓ updatedBy reflects authenticated user



Test Result: PASS


4. Booking Endpoints

4.1 POST /bookings - Create Booking


Test ID: API_BKG_001

Priority: Critical

Request:
POST /api/v1/bookings
Authorization: Bearer {token}
Content-Type: application/json

{
"itineraryId": "ITN_001",
"supplierId": "SUP_456",
"type": "hotel",
"checkIn": "2026-06-01",
"checkOut": "2026-06-07",
"guests": 2,
"roomType": "deluxe",
"specialRequests": "Late checkout if possible"
}

Expected Response: 201 Created


{
"id": "BKG_890",
"itineraryId": "ITN_001",
"supplierId": "SUP_456",
"confirmationNumber": "CONF789012",
"type": "hotel",
"checkIn": "2026-06-01",
"checkOut": "2026-06-07",
"guests": 2,
"roomType": "deluxe",
"status": "pending",
"price": 1200.00,
"currency": "USD",
"createdAt": "2026-01-29T13:00:00Z"
}

Validation Checks:

✓ Status code is 201


✓ Booking ID generated

✓ Confirmation number generated


✓ Default status is "pending"




 ✓ Price is calculated

Test Result: PASS


4.2 PATCH /bookings/{id}/status - Update Booking Status
Test ID: API_BKG_002

Priority: Critical

Request:
PATCH /api/v1/bookings/BKG_890/status
Authorization: Bearer {token}
Content-Type: application/json

{
"status": "confirmed",
"notes": "Payment received via credit card"
}

Expected Response: 200 OK


{
"id": "BKG_890",
"status": "confirmed",
"statusHistory": [
{
"status": "pending",
"timestamp": "2026-01-29T13:00:00Z",
"updatedBy": "USR_001"
},
{
"status": "confirmed",
"timestamp": "2026-01-29T14:00:00Z",
"updatedBy": "USR_001",
"notes": "Payment received via credit card"
}
]
}

Validation Checks:

✓ Status code is 200


✓ Status is updated to "confirmed"

✓ Status history is maintained


✓ Notes are recorded



Test Result: PASS


5. Supplier Endpoints

5.1 GET /suppliers/search - Search Suppliers


Test ID: API_SUP_001

Priority: High

Request:
GET /api/v1/suppliers/search?location=Paris&type=hotel&available=true
Authorization: Bearer {token}

Expected Response: 200 OK


{
"suppliers": [
{
"id": "SUP_456",
"name": "Hotel Grand Paris",
"type": "hotel",
"location": "Paris, France",
"rating": 4.5,
"priceRange": "$$$",
"availability": "available",
"amenities": ["wifi", "pool", "restaurant"]
}
],
"count": 15,
"filters": {
"location": "Paris",
"type": "hotel",
"available": true
}
}

Validation Checks:

✓ Status code is 200


✓ Only matching suppliers returned

✓ Count reflects number of results


✓ Applied filters are returned



Test Result: PASS


6. Error Handling Tests

6.1 404 Not Found


Test ID: API_ERR_001

Priority: Medium

Request:
GET /api/v1/itineraries/INVALID_ID
Authorization: Bearer {token}

Expected Response: 404 Not Found


{
"error": "Not Found",
"message": "Itinerary with ID 'INVALID_ID' not found",
"timestamp": "2026-01-29T15:00:00Z"
}

Validation Checks:

✓ Status code is 404


✓ Error message is descriptive

Test Result: PASS


6.2 400 Bad Request - Validation Error
Test ID: API_ERR_002

Priority: High

Request:
POST /api/v1/itineraries
Authorization: Bearer {token}
Content-Type: application/json

{
"clientId": "",
"destination": "",
"startDate": "invalid-date"
}

Expected Response: 400 Bad Request


{
"error": "Validation Error",
"message": "Request validation failed",
"fields": {
"clientId": "Client ID is required",
"destination": "Destination is required",
"startDate": "Invalid date format. Expected: YYYY-MM-DD"
},
"timestamp": "2026-01-29T15:30:00Z"
}

Validation Checks:

✓ Status code is 400


✓ Field-specific error messages provided

✓ All validation errors returned at once



Test Result: PASS


6.3 401 Unauthorized - Missing Token
Test ID: API_ERR_003

Priority: High

Request:
GET /api/v1/itineraries
(No Authorization header)

Expected Response: 401 Unauthorized


{
"error": "Unauthorized",
"message": "Authentication required. Please provide a valid token.",
"timestamp": "2026-01-29T16:00:00Z"
}

Validation Checks:

✓ Status code is 401


✓ Clear authentication error message

Test Result: PASS


7. Test Summary
Total API Tests Executed: 15

Passed: 15

Failed: 0

Pass Rate: 100%

7.1 Coverage by Endpoint


 Authentication: 2 tests
 Itineraries: 4 tests
 Bookings: 2 tests
 Suppliers: 1 test
 Error Handling: 3 tests
 Additional Tests: 3 tests

7.2 HTTP Methods Tested


 GET: 6 tests
 POST: 5 tests
 PUT: 1 test
 PATCH: 2 tests
 DELETE: 1 test

7.3 Key Findings


✓ All endpoints respond with correct HTTP status codes
✓ Request/response payloads match API specification
✓ Error handling is consistent and informative
✓ Authentication and authorization work as expected
✓ Data validation is properly implemented
✓ Response times are acceptable (all < 500ms in QA environment)

You might also like