Test 학습 목차
├─ 1. 테스트 범위
│  ├─ unit test
│  ├─ integration test
│  ├─ e2e test
│  ├─ system test
│  └─ smoke test
│
├─ 2. 테스트 경계
│  ├─ function boundary
│  ├─ class boundary
│  ├─ module boundary
│  ├─ HTTP boundary
│  ├─ DB boundary
│  ├─ filesystem boundary
│  ├─ external API boundary
│  ├─ message queue boundary
│  ├─ browser boundary
│  └─ process/container boundary
│
├─ 3. 테스트 구조
│  ├─ Arrange
│  ├─ Act
│  ├─ Assert
│  ├─ Setup
│  ├─ Teardown
│  ├─ Cleanup
│  └─ Given / When / Then
│
├─ 4. 구현 레벨
│  ├─ 4-1. 실행 도구
│  │  ├─ test runner
│  │  ├─ coverage tool
│  │  ├─ reporter
│  │  ├─ watch mode
│  │  └─ CI execution
│  │
│  ├─ 4-2. 작성 API
│  │  ├─ test()
│  │  ├─ it()
│  │  ├─ describe()
│  │  ├─ before()
│  │  ├─ after()
│  │  ├─ beforeEach()
│  │  ├─ afterEach()
│  │  ├─ assert
│  │  ├─ expect
│  │  └─ matcher
│  │
│  ├─ 4-3. 의존성 대체
│  │  ├─ dummy
│  │  ├─ stub
│  │  ├─ fake
│  │  ├─ mock
│  │  ├─ spy
│  │  ├─ fake timer
│  │  ├─ mock function
│  │  ├─ mock module
│  │  └─ mock class
│  │
│  └─ 4-4. 테스트 데이터
│     ├─ fixture
│     ├─ factory
│     ├─ seed
│     ├─ snapshot
│     ├─ parameterized data
│     ├─ dynamic test cases
│     └─ test case table
│
├─ 5. 상황별 테스트 패턴
│  ├─ async test
│  ├─ promise resolve/reject test
│  ├─ error test
│  ├─ timer test
│  ├─ stream test
│  ├─ event emitter test
│  ├─ HTTP test
│  ├─ DB transaction test
│  ├─ file upload/download test
│  ├─ auth test
│  ├─ middleware test
│  ├─ dynamic test generation
│  └─ snapshot test
│
├─ 6. 테스트 목적
│  ├─ correctness
│  ├─ regression prevention
│  ├─ refactoring safety
│  ├─ documentation
│  └─ confidence
│
├─ 7. 테스트 품질 기준
│  ├─ deterministic
│  ├─ isolated
│  ├─ repeatable
│  ├─ fast
│  ├─ readable
│  ├─ maintainable
│  └─ flaky test
│
├─ 8. 실행 환경
│  ├─ local Node.js
│  ├─ browser-like environment
│  ├─ real browser
│  ├─ Docker
│  ├─ Testcontainers
│  ├─ CI
│  ├─ staging
│  └─ production smoke
│
└─ 9. 프로젝트 운영
   ├─ file convention
   ├─ npm scripts
   ├─ test config
   ├─ coverage threshold
   ├─ CI connection
   ├─ test DB lifecycle
   ├─ test container lifecycle
   └─ execution strategy

1. 테스트 범위의 이해

Feature  특징/장점 Small  작음 Medium  중간 Large  크다/대형
Network access  네트워크 접속 No  아니요. localhost only  로컬호스트 전용 Yes  네.
Database  데이터베이스 No  아니요. Yes  네. Yes  네.
File system access  파일 시스템 접근 No  아니요. Yes  네. Yes  네.
Use external systems  외부 시스템을 사용하세요. No  아니요. Discouraged  낙담했다. Yes  네.
Multiple threads  여러 개의 스레드 No  아니요. Yes  네. Yes  네.
Sleep statements  수면 관련 명령어들/수면을 유도하는 명령들 No  아니요. Yes  네. Yes  네.
System properties  시스템 속성 No  아니요. Yes  네. Yes  네.
Time limit (seconds)  제한 시간 (초) 60 300 900+

1-1. nodejs learn - test runner 기준 분류

type description example mock candidates
unit the smallest bit of code you can isolate const sum = (a, b) => a + b own code, external code, external system
component a unit + dependencies const arithmetic = (op = sum, a, b) => ops[op](a, b) external code, external system
integration components fitting together - external code, external system
end-to-end (e2e) app + external data stores, delivery, etc A fake user (ex a Playwright agent) literally using an app connected to real external systems. none (do not mock)

1-2. https://martinfowler.com/articles/practical-test-pyramid.html

image.png

2. Test Runner 와 테스트 구조

image.png

1. 실행 시스템