Files
Timeline_Generator/TDD.md
beabigegg 2d37d23bcf v9.5: 實作標籤完全不重疊算法
- 新增 _calculate_lane_conflicts_v2() 分開返回標籤重疊和線穿框分數
- 修改泳道選擇算法,優先選擇無標籤重疊的泳道
- 兩階段搜尋:優先側別無可用泳道則嘗試另一側
- 增強日誌輸出,顯示標籤範圍和詳細衝突分數

🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 11:35:29 +08:00

55 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 📙 Test Driven Development (TDD)
## 1. 測試分類與範圍
| 類型 | 工具 | 範圍 |
|------|------|------|
| 單元測試 | pytest | importer、renderer、export 模組 |
| 端對端測試 | Playwright | 前端互動與整體流程 |
| 效能測試 | pytest-benchmark | 渲染與輸出效能 |
---
## 2. 單元測試案例
| 編號 | 測試項目 | 驗證重點 |
|------|-----------|------------|
| UT-IMP-01 | 匯入 CSV 欄位解析 | 欄位自動對應與格式容錯 |
| UT-REN-01 | 時間刻度演算法 | 不同時間跨度下刻度精準性 |
| UT-REN-02 | 節點避碰演算法 | 重疊節點之排版與間距合理性 |
| UT-EXP-01 | PDF 輸出完整性 | 字型嵌入與 DPI 驗證 |
---
## 3. 端對端測試E2E流程
1. 匯入測試資料CSV
2. 驗證時間軸正確渲染。
3. 切換主題並重新渲染。
4. 匯出 PNG/PDF 並確認檔案存在與開啟性。
5. 驗證畫面快照差異 ≤ 0.5%。
---
## 4. 效能與穩定性測試
| 測試項目 | 標準 | 通過條件 |
|-----------|------|-----------|
| 100 筆事件 | <1 | 無延遲或崩潰 |
| 300 筆事件 | <3 | FPS 30 |
| 匯出任務 | <2 | 正確生成檔案 |
---
## 5. 測試環境與自動化
| 組件 | 工具 |
|------|------|
| 測試框架 | pytest, Playwright |
| 持續整合 | GitHub Actions |
| 覆蓋率 | coverage.py + htmlcov |
| 報告生成 | Allure / pytest-html |
---
## 6. 驗收條件
- 單元測試覆蓋率 80%。
- E2E 測試通過率 = 100%。
- 效能達標渲染與輸出均在 KPI