This document outlines the test strategy, tools, and execution flow for the express-react-fullstack application.
-
Scope: Test isolated utility functions, specifically
assembleUserStatelogic. -
Tooling:
mocha,chai -
Location:
test/BackendTestingFolder/unit.test.js -
Focus:
- User session state assembly.
- Correct retrieval of user tasks, groups, users, and comments.
-
Run Command:
npm run test-backend
-
Success Criteria:
- All utility functions produce correct output.
- Data integrity in user state assembly is verified.
-
Scope: Verify API routes and DB interactions.
-
Tooling:
mocha,chai,supertest -
Location:
test/BackendTestingFolder/integrate.test.jstest/BackendTestingFolder/mongoMemory.test.js
-
Focus:
- Create and authenticate users.
- Create, update tasks.
- DB consistency between real MongoDB and in-memory DB.
-
Run Command:
npm run test-backend
-
Success Criteria:
- API endpoints return correct HTTP status and response payloads.
- Database reflects expected changes.
-
Scope: Browser automation simulating user actions.
-
Tooling:
selenium-webdriver,mocha,chai -
Location:
test/FrontendTestingFolder/selenium.test.mjs -
Focus:
- Sign up new user.
- Login user.
- Verify redirection to dashboard.
- Capture screenshots during each step.
-
Run Command:
npm run test-frontend
-
Success Criteria:
- Navigation flow succeeds without errors.
- Screenshots captured at key milestones.
- URLs match expected paths.
-
Scope: Validate system performance under load.
-
Tooling:
k6 -
Location:
test/PerformanceTestingFolder/load_test.js -
Focus:
- Load test user creation, authentication, task/comment operations.
- Assess response codes and basic response validation.
-
Run Command:
k6 run test/PerformanceTestingFolder/load_test.js
-
Success Criteria:
- APIs handle increasing load without failure.
- Response times stay within acceptable limits.
1️⃣ Run backend unit and integration tests - npm run test-backend
2️⃣ Run frontend Selenium E2E tests - npm run test-frontend
3️⃣ Run load tests - k6 run test/PerformanceTestingFolder/load_test.js- Real DB Integration: Run
npm run server - Memory DB Integration: Run
npm run server-memory - Dev mode (for Selenium): Run
npm run start-dev
| Test Type | File Path |
|---|---|
| Unit | test/BackendTestingFolder/unit.test.js |
| Integration | test/BackendTestingFolder/integrate.test.js |
| Integration (Memory) | test/BackendTestingFolder/mongoMemory.test.js |
| Frontend E2E | test/FrontendTestingFolder/selenium.test.mjs |
| Load Test | test/PerformanceTestingFolder/load_test.js |
This test plan ensures the correctness, resilience, and performance of express-react-fullstack through comprehensive unit, integration, E2E, and load tests using a modern JS testing stack.