Skip to content

guneyee/lab6

Repository files navigation

Lab 6: Testing Principles and Test Generation

This project is a TypeScript sample workspace prepared for a SpecKit-style testing lab.

It demonstrates the full flow below:

  • configure testing principles in the constitution
  • generate test tasks from feature specs
  • implement code and tests with a TDD workflow
  • validate results with typecheck, lint, tests, and coverage

Stack

  • TypeScript 5
  • Jest + ts-jest
  • ESLint 9
  • Node.js + npm

Project Layout

.
|- .specify/memory/constitution.md
|- specs/001-user-auth/spec.md
|- specs/002-password-change/spec.md
|- specs/003-user-profile/spec.md
|- specs/001-user-auth/tasks.md
|- specs/002-password-change/tasks.md
|- specs/003-user-profile/tasks.md
|- src/auth/
|- tests/unit/auth/
|- tests/integration/auth/
|- tests/e2e/auth/
|- LAB-07-EXECUTION-CHECKLIST.md
|- stryker.config.json

What Is Implemented

Features: user authentication, password change, user profile lookup

  • email validation
  • password strength validation
  • registration flow
  • login flow
  • password change flow
  • profile lookup flow
  • deterministic auth error codes
  • in-memory repository for testable integration flow

Testing Principles Summary

The project follows the testing constitution in .specify/memory/constitution.md.

Key rules:

  • TDD: RED -> GREEN -> REFACTOR
  • Testing pyramid: ~70% unit, ~20% integration, ~10% E2E
  • AAA test structure
  • independent tests with beforeEach
  • meaningful assertions only
  • no testing of private internals

Commands

Install dependencies:

npm install

Run typecheck:

npm run typecheck

Run lint:

npm run lint

Run all tests:

npm test

Run unit tests only:

npm run test:unit

Run integration tests only:

npm run test:integration

Run E2E tests only:

npm run test:e2e

Generate coverage:

npm run test:coverage

Run mutation testing:

npm run test:mutation

Current Validation Status

Validated after implementing all three features:

  • typecheck passes
  • lint passes
  • tests pass
  • coverage exceeds constitution targets
  • mutation testing runs successfully with Stryker

Measured coverage:

  • line coverage: 96.84%
  • branch coverage: 95%

Measured mutation score:

  • total mutation score: 86.25%
  • HTML report: reports/mutation/mutation.html

Feature Artifacts

Notes

  • test:mutation now uses stryker.config.json with the Jest runner plugin for this TypeScript workspace.
  • The current E2E layer is implemented as a high-level flow test with Jest inside this sample workspace.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors