testing-matrix-navigator

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Testing Matrix Navigator

测试矩阵导航器

Utilise cette compétence pour planifier et exécuter les tests pertinents après une modification.
在代码变更后,使用本指南来规划并执行相关测试。

Pré-requis

前置条件

  • Virtualenv
    /mnt/venv_ext4/venv_render_signal_server
    activé.
  • Variables ENV exportées (
    FLASK_SECRET_KEY
    , etc.) via
    .env
    .
  • Accès aux marqueurs Pytest réellement déclarés (
    unit
    ,
    integration
    ,
    e2e
    ,
    slow
    ,
    redis
    ,
    imap
    ).
  • 已激活Virtualenv
    /mnt/venv_ext4/venv_render_signal_server
  • 已通过
    .env
    文件导出环境变量(如
    FLASK_SECRET_KEY
    等)
  • 可访问已声明的Pytest标记(
    unit
    integration
    e2e
    slow
    redis
    imap

Matrice de décision

决策矩阵

ContexteCommande helperDescription
Modifications backend générales
./run_tests.sh -u
Tests unitaires sans dépendances externes
Config/Redis
pytest -m redis
Tests marqués Redis
R2 / Offload
pytest tests/test_r2_transfer_service.py
Couverture ciblée du service R2
Routing rules
pytest tests/routes/test_api_routing_rules.py tests/email_processing/test_routing_rules_orchestrator.py
API + orchestrateur
Magic link
pytest tests/test_services.py -k magic_link
Couverture ciblée du service Magic Link
Full suite
./run_tests.sh -a -c
Tous les tests avec couverture
上下文辅助命令描述
通用后端变更
./run_tests.sh -u
无外部依赖的单元测试
配置/Redis相关
pytest -m redis
标记为Redis的测试
R2 / 流量卸载相关
pytest tests/test_r2_transfer_service.py
R2服务的定向测试覆盖
路由规则相关
pytest tests/routes/test_api_routing_rules.py tests/email_processing/test_routing_rules_orchestrator.py
API + 编排器测试
Magic link相关
pytest tests/test_services.py -k magic_link
Magic Link服务的定向测试覆盖
全量测试套件
./run_tests.sh -a -c
带覆盖率统计的全量测试

Workflow

工作流

  1. Préparer l'environnement
    • Activer
      /mnt/venv_ext4/venv_render_signal_server
      .
    • Exporter les variables requises via
      .env
      .
  2. Sélectionner la suite
    • Utiliser
      ./run_tests.sh
      avec les options appropriées.
    • Pour un diff large, exécuter
      pytest --maxfail=1 --disable-warnings
      d'abord, puis
      pytest --cov=.
      .
  3. Commandes avancées
    • Tests ciblés :
      pytest tests/routes/test_api_routing_rules.py
    • Scénarios spécifiques :
      pytest tests/email_processing/test_routing_rules_orchestrator.py -k stop_processing
    • Magic link :
      pytest tests/test_services.py -k magic_link
    • R2 :
      pytest tests/test_r2_transfer_service.py
    • Durées :
      pytest --durations=20
  4. Analyse des résultats
    • Corriger immédiatement les échecs introduits.
    • Si une suite est flaky, documenter dans la Memory Bank avec étapes de reproduction.
  5. Rapports
    • Pour la CI, viser couverture ≥70% (88 cols, black/isort conformes).
  1. 环境准备
    • 激活
      /mnt/venv_ext4/venv_render_signal_server
    • 通过
      .env
      导出所需环境变量
  2. 选择测试套件
    • 搭配合适的参数使用
      ./run_tests.sh
    • 如果变更差异较大,先执行
      pytest --maxfail=1 --disable-warnings
      ,再运行
      pytest --cov=.
  3. 高级命令
    • 定向测试:
      pytest tests/routes/test_api_routing_rules.py
    • 特定场景测试:
      pytest tests/email_processing/test_routing_rules_orchestrator.py -k stop_processing
    • Magic link测试:
      pytest tests/test_services.py -k magic_link
    • R2测试:
      pytest tests/test_r2_transfer_service.py
    • 耗时统计:
      pytest --durations=20
  4. 结果分析
    • 立即修复引入的测试失败问题
    • 如果某个测试套件不稳定,需在记忆库中记录并附复现步骤
  5. 报告要求
    • CI环境下,测试覆盖率需≥70%(88列宽,符合black/isort规范)

Ressources

资源

  • run_tests.sh
    : script principal à la racine qui active le venv et exécute les suites demandées (unit, integration, e2e, fast, coverage).
  • run_tests.sh
    :根目录下的主脚本,负责激活虚拟环境并执行指定的测试套件(单元、集成、端到端、快速、覆盖率)

Conseils

建议

  • Grouper les tests par dossier modifié pour diagnostiquer plus vite.
  • Relire
    pytest.ini
    pour les options par défaut (plugins, markers).
  • Ajouter des tests Given/When/Then lors de nouvelles fonctionnalités.
  • 按修改的目录对测试进行分组,可加快问题排查速度
  • 重读
    pytest.ini
    了解默认配置(插件、标记等)
  • 新增功能时请编写Given/When/Then格式的测试用例