테스팅 피라미드
E2E
Integration
Unit
Unit Tests
개별 함수/컴포넌트 테스트
- ✅ 빠른 실행 (ms)
- ✅ 격리된 테스트
- ✅ 가장 많이 작성
Integration Tests
모듈 간 상호작용 테스트
- ✅ API 엔드포인트
- ✅ DB 연동
- ⚠️ 설정 필요
E2E Tests
전체 사용자 시나리오
- ✅ 실제 브라우저
- ⚠️ 느린 실행 (s)
- ⚠️ 최소한으로
권장 비율
Unit 70% · Integration 20% · E2E 10%
Choorai 프로젝트 테스트 현황
| 프로젝트 | API (Python) | API (Hono) | API (NestJS) | Web (React) | Web (Vue) |
|---|---|---|---|---|---|
| B2B Admin | 19 | 16 | 12 | 11 | 11 |
| B2C Todo | 23 | 19 | 13 | 12 | 5 |
| 총계 | 141개 | ||||
테스트 도구
테스트 실행하기
Python (pytest)
터미널
# B2B Admin API 테스트
cd examples/b2b-admin/api
pip install -r requirements.txt
pytest -v
# B2C Todo API 테스트
cd examples/b2c-todo/api
pytest -vNode.js (Vitest)
터미널
# Hono API 테스트
cd examples/b2b-admin/api-hono
npm install
npm run test:run
# Vue 프론트엔드 테스트
cd examples/b2b-admin/web-vue
npm install
npm run test:runNestJS (Jest)
터미널
# NestJS E2E 테스트
cd examples/b2b-admin/api-nest
npm install
npm run test:e2eCI/CD 통합
Choorai는 GitHub Actions를 사용하여 모든 PR에서 자동으로 테스트를 실행합니다.
.github/workflows/ci.yml
# .github/workflows/ci.yml
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Python 테스트
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Run Python tests
run: |
cd examples/b2b-admin/api
pip install -r requirements.txt
pytest -v
# Node.js 테스트
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Run Hono tests
run: |
cd examples/b2b-admin/api-hono
npm ci
npm run test:run모든 테스트 통과 후 머지
PR이 머지되기 전에 모든 테스트가 통과해야 합니다. GitHub Actions에서 실행 상태를 확인하세요.
다음 단계
단위 테스트 가이드에서 pytest와 Vitest 사용법을 자세히 배웁니다.
E2E 테스트 가이드에서 Playwright로 브라우저 테스트를 작성합니다.