This document outlines the testing approach, tools, user stories, and acceptance tests for the Hiking Logbook application.
Testing ensures the app is reliable, secure, and production-ready.
We use a layered testing strategy:
Tool / Framework | Purpose |
---|---|
Jest | Unit testing for backend logic and React components |
React Testing Library | Testing React components in isolation |
Firebase Emulator Suite | Local testing of Firestore, Auth, and Functions |
Postman / curl | Testing API endpoints |
ESLint + Prettier | Code quality & linting |
GitHub Actions (CI/CD) | Running automated tests on every push |
Endpoint | Test Case | Expected Result |
---|---|---|
POST /api/hikes |
Create a new hike with valid data | Returns 201 Created with hike ID |
GET /api/hikes |
Fetch all hikes for logged-in user | Returns list of hikes |
PATCH /api/hikes/:id/pin |
Pin a hike | Returns success: true and hike updated |
GET /api/stats |
Retrieve stats for user | Returns total hikes, distance, streak |
POST /api/messages |
Send a new message to a friend | Returns 201 Created with message details |
POST /api/invitations |
Invite a friend to a hike | Returns 201 Created and notifies invitee |
GET /api/achievements |
Fetch user’s achievements and badges | Returns list of badges and progress |
GET /api/friends |
Retrieve user’s friend list | Returns array of friend profiles |
Component | Test Case | Expected Result |
---|---|---|
LogbookPage |
Render hikes from API | Hike cards are displayed correctly |
ProgressCharts |
Load progress stats | Line and bar charts render with data |
PinnedHikes |
Pin/unpin hike buttons | UI updates without reload |
HikePlannerForm |
Form validation with missing fields | Error messages are shown |
MessagesPage |
Send and receive messages | Messages appear instantly in chat |
InvitationsPanel |
Display received invitations | Invitations render correctly |
AchievementsPage |
Display badges and progress charts | Charts update dynamically |
ActivityFeedPage |
Fetch and display friends’ activity | Posts load and render in correct order |
UserProfilePage |
Load and edit user details | Profile updates persist after reload |
As a user, I want to log my completed hike so that I can keep a history of my outdoor activities.
Acceptance Test:
As a user, I want to view statistics and charts of my hikes so that I can track my progress over time.
Acceptance Test:
As a user, I want to pin my favorite hikes so that I can easily access them later.
Acceptance Test:
As a user, I want to add planned hikes with dates and difficulty levels so that I can prepare in advance.
Acceptance Test:
As a user, I want to send and receive messages in real time so that I can communicate with my hiking partners.
Acceptance Test:
As a user, I want to see my friends’ recent hikes so that I can stay updated on their adventures.
Acceptance Test:
As a user, I want to edit my profile information and view my hiking stats in one place.
Acceptance Test:
As a user, I want to unlock badges based on my hiking milestones so that I stay motivated.
Acceptance Test:
Run backend tests ```bash cd backend npm test
Run frontend tests ```bash cd frontend npm test