Quality & Security

1. Objective

The purpose of testing is to prove that TeamFlow reliably:

  • Preserves requirement history
  • Enforces authorization
  • Controls change workflows
  • Supports planning and QA traceability
  • Provides trustworthy management information

2. Test Levels

  • Unit testing
  • Repository testing
  • Integration testing
  • API contract testing
  • Frontend component testing
  • End-to-end testing
  • Security testing
  • Performance testing
  • Accessibility testing
  • Usability testing
  • Backup and recovery testing
  • User acceptance testing

3. Test Environments

Local

Used by developers for:

  • Unit tests
  • Component tests
  • Fast integration tests
  • Manual development checks

CI

Used for:

  • Formatting and linting
  • Unit tests
  • Integration tests
  • Build verification
  • Migration validation
  • Dependency scan
  • Selected end-to-end tests

QA

Used for:

  • Full workflow testing
  • Regression testing
  • Browser testing
  • Security checks
  • UAT preparation

Demo

Contains seeded, repeatable data for CTO demonstration with reset capability.

4. Unit Testing

Backend Unit Tests

Must cover:

  • Requirement creation and submission validation
  • Review transitions and approval rules
  • Approved-version immutability
  • New version creation from change requests
  • Change request transitions and impact analysis
  • Separation of duties enforcement
  • Task and test transitions
  • Release readiness calculation
  • Audit event creation

Frontend Unit/Component Tests

Must cover:

  • Required field validation
  • Role-based action visibility
  • Status badges and state rendering
  • Approval forms and workflows
  • Version comparison rendering
  • Impact total calculation and display
  • Error handling and messages
  • Confirmation dialogs
  • Empty states and loading states

5. Integration Testing

Integration tests must use a real PostgreSQL test database.

Test:

  • Database migrations
  • Constraints enforcement
  • Transactions and rollback behavior
  • Repository operations
  • Optimistic locking
  • Current approved version uniqueness
  • Audit log persistence
  • Query filtering and pagination
  • Project isolation

Critical Transaction Test

A comprehensive test that:

  1. Approves a requirement version
  2. Stores approval record
  3. Creates immutable snapshot
  4. Sets current approved version
  5. Creates audit event
  6. Intentionally fails one step
  7. Verifies no partial state remains (rollback works)

6. API Contract Testing

  • Verify all endpoints return correct status codes
  • Validate response structures match contract
  • Test pagination parameters and sorting
  • Verify error responses follow standard format
  • Test trace ID inclusion in all responses
  • Verify optimistic locking conflicts return 409
  • Test immutability protection returns correct error

7. End-to-End Testing

Critical workflows to test:

  • Create → Submit → Review → Approve requirement
  • Create change request on approved version
  • Link tasks and tests to requirement versions
  • Approve change, verify new version created
  • Mark tests REVIEW_REQUIRED when requirement changes
  • Release readiness calculation

8. Security Testing

  • Verify cross-project data isolation
  • Test role-based access control
  • Verify unauthorized access is denied
  • Test separation of duties (self-approval prevention)
  • Verify password hashing
  • Test session expiration
  • Verify audit logging of sensitive actions
  • OWASP Top 10 vulnerability scanning
  • SQL injection prevention
  • XSS prevention

9. Performance Testing

  • List endpoints return < 2s for 95th percentile
  • Detail endpoints return < 2s for 95th percentile
  • Version comparison returns < 3s
  • Dashboard queries return < 5s
  • System supports 100 concurrent users
  • Identify and resolve performance regressions

10. Test Coverage Goals

  • Critical business logic: > 95% code coverage
  • Authorization logic: > 90% code coverage
  • API endpoints: > 85% coverage
  • Workflow state machines: > 95% coverage
  • Data validation: > 90% coverage

11. Test Data and Demo Scenario

  • Use repeatable seeded data
  • Demo scenario can be reset with a command
  • Include all 7 demo user roles
  • Demonstrate complete workflow from requirement to release
  • Show change request approval and new version creation

Next: Review the Development Roadmap →