Testing Guide
This section covers testing strategies and best practices for the Hello World Co-Op platform.
Test Stack
| Layer | Tool | Purpose |
|---|---|---|
| Backend Unit | cargo test | Rust canister logic |
| Backend Integration | PocketIC | Multi-canister interactions |
| Frontend Unit | Vitest | Component logic, stores, services |
| Frontend Component | React Testing Library | Component rendering |
| E2E | Playwright | Browser-based user flows |
| QA | Playwright MCP | Manual verification automation |
Testing Guides
| Guide | Description |
|---|---|
| Testing Pyramid Guidelines | What belongs at each test layer |
| PocketIC Setup | How to set up PocketIC for canister testing |
| Visualization Testing | Strategy for charts and SVG components |
Quick Start
Run Backend Tests
bash
cd <canister-repo>
cargo testRun Frontend Tests
bash
cd foundery-os-suite
npm test # Run all tests
npm test -- --watch # Watch mode
npm test -- --coverage # With coverageRun E2E Tests
bash
cd foundery-os-suite
npm run test:e2e # Playwright testsTest Naming Conventions
typescript
// Describe block: Component or module name
describe('BurndownChart', () => {
// Nested describe: Feature or AC reference
describe('rendering (AC-2.2.3.1)', () => {
// It block: Specific behavior
it('renders chart container with aria-label', () => {
// ...
});
});
});Test File Structure
src/
├── components/
│ └── backlog/
│ ├── BurndownChart.tsx
│ └── __tests__/
│ └── BurndownChart.test.tsx
├── stores/
│ ├── sprintStore.ts
│ └── __tests__/
│ └── sprintStore.test.ts
└── services/
├── sprintService.ts
└── __tests__/
└── sprintService.test.tsCoverage Goals
| Type | Target | Notes |
|---|---|---|
| Unit Tests | 80%+ | Focus on business logic |
| Component Tests | 70%+ | Key UI interactions |
| E2E Tests | Critical paths | Login, core workflows |