Skip to content

Conversation

@bot0419
Copy link
Collaborator

@bot0419 bot0419 commented Jul 7, 2025

[Enhancement] #9 - 慢速測試條件編譯與測試策略優化 工作報告

任務:將執行時間超過 30 秒的慢速測試以 #[cfg(feature = 'slow-tests')] 標記,並於 Cargo.toml 新增 slow-tests feature,配合 nextest 與腳本支援完整/快速測試切換。
類型:Enhancement
狀態:已完成

一、任務概述

本次針對專案中 14 個執行時間超過 30 秒的慢速測試,統一以 Rust feature flag slow-tests 條件編譯,並於 Cargo.toml 新增對應 feature。搭配 nextest.toml 與 scripts/quality_check.sh、scripts/check_coverage.sh,實現本地預設跳過慢速測試,CI 及 --full 參數時完整執行。

二、實作內容

2.1 測試條件編譯標記

  • 於 5 個測試檔案共 14 個慢速測試加上 #[cfg(feature = 'slow-tests')]
  • 【F:tests/sync_parameter_combinations_tests.rs†L11-L200】等

2.2 Cargo.toml feature 設定

  • 新增 [features] 與 slow-tests
  • 【F:Cargo.toml†L100-L105】

三、技術細節

3.1 架構變更

  • 測試以 feature flag 控制執行,提升彈性與維護性

3.2 API 變更

  • 無對外 API 變更

3.3 配置變更

  • Cargo.toml 新增 features

四、測試與驗證

4.1 程式碼品質檢查

cargo fmt -- --check
cargo clippy -- -D warnings

4.2 功能測試

  • 預設 profile 下慢速測試未執行
  • --full/CI profile 下慢速測試皆執行

4.3 覆蓋率測試

  • 維持 75% 以上

五、影響評估

5.1 向後相容性

  • 不影響現有功能,僅影響測試執行策略

5.2 使用者體驗

  • 本地測試更快速,CI 保持完整性

六、問題與解決方案

6.1 遇到的問題

6.2 技術債務

七、後續事項

7.1 待完成項目

  • 文件補充 slow-tests 說明

7.2 相關任務

7.3 建議的下一步

  • 持續監控慢速測試,適時調整

八、檔案異動清單

檔案路徑 異動類型 描述
tests/sync_parameter_combinations_tests.rs 修改 加上 #[cfg(feature = 'slow-tests')]
tests/sync_comprehensive_integration_tests.rs 修改 加上 #[cfg(feature = 'slow-tests')]
tests/sync_batch_subtitle_only_skip_tests.rs 修改 加上 #[cfg(feature = 'slow-tests')]
tests/vad_detector_tests.rs 修改 加上 #[cfg(feature = 'slow-tests')]
tests/sync_first_sentence_offset_integration_tests.rs 修改 加上 #[cfg(feature = 'slow-tests')]
Cargo.toml 修改 新增 features 與 slow-tests

九、關聯項目

Resolves #9

bot0419 added 3 commits July 7, 2025 13:49
Update .config/nextest.toml, check_coverage.sh, and quality_check.sh to support --full flag and slow-tests feature. See #9.

Signed-off-by: CHEN, CHUN <jim60105@gmail.com>
Mark all 14 slow tests with #[cfg(feature = 'slow-tests')] and add feature config to Cargo.toml. See #9.

Signed-off-by: CHEN, CHUN <jim60105@gmail.com>
Add --full to quality_check.sh and check_coverage.sh, and --features slow-tests to coverage generation. See #9.

Signed-off-by: CHEN, CHUN <jim60105@gmail.com>
@codecov
Copy link

codecov bot commented Jul 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

- Combine coverage generation and threshold enforcement into a single workflow step by calling the check_coverage.sh script with the new --lcov option and setting COVERAGE_THRESHOLD
- Remove the old, separate “Check coverage threshold” job to streamline CI coverage checks
- Add LCOV_OUTPUT_PATH support and a --lcov flag in check_coverage.sh, with updated usage instructions
- Refactor coverage logic to run tests once, then emit LCOV and JSON reports via cargo llvm-cov report, reducing duplicate test runs and improving success/error messages

Signed-off-by: CHEN, CHUN <jim60105@gmail.com>
@jim60105 jim60105 merged commit 2fe7316 into master Jul 7, 2025
5 checks passed
@jim60105 jim60105 deleted the issue-9-slow-tests-feature branch July 7, 2025 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

優化測試執行策略:將執行時間超過30秒的測試設為僅在CI中執行

3 participants