跳转至

使用指南

本部分详细介绍 YuanTest Playwright 的各种使用方式。

目录

深度指南

如需了解特定领域的深入内容,请参考深度指南:

  • Flaky 测试管理 - 分类算法、根因分析、关联分析、趋势追踪、隔离策略、健康评分、因果图、参数自定义
  • AI 智能诊断 - 上下文富集、知识库、Agent 推理、置信度校准、流式诊断、LLM 配置

推荐工作流程

开发阶段

  1. 使用 Web UI 快速调试
  2. 启动 Dashboard:yuantest ui
  3. 在界面中选择要执行的测试
  4. 实时查看测试进度和结果
  5. 快速定位失败原因

  6. 使用 --grep 参数运行特定测试

    yuantest run --grep "登录功能" --output ./test-reports
    

  7. 查看详细报告

  8. 在 Dashboard 中查看测试详情
  9. 查看 Trace 文件分析失败原因
  10. 查看截图和视频

  11. AI 诊断失败测试

  12. 在 Dashboard 中点击"AI 诊断"
  13. 或使用 CLI:yuantest analyze --id <run-id> --ai

CI/CD 阶段

  1. 使用命令行执行完整测试套件

    yuantest run --test-dir ./ --output ./test-reports --shards 4
    

  2. 检查 Flaky 测试健康度

    yuantest health --json
    yuantest prediction --high-risk --json
    

  3. 上传报告作为 artifact

  4. GitHub Actions: actions/upload-artifact
  5. GitLab CI: artifacts

  6. 可选:部署 Dashboard 服务器

  7. 在服务器上运行 yuantest ui
  8. 团队成员可以随时查看历史报告

Flaky 测试治理

  1. 识别 Flaky 测试

    yuantest flaky --list --json
    yuantest correlations
    

  2. 分析根因

    yuantest analyze --id <run-id> --ai
    

  3. 隔离和监控

  4. 在 Dashboard 中隔离 Flaky 测试
  5. 设置监控阈值和隔离参数
  6. 定期查看健康度评分

  7. 验证修复

    yuantest rerun <run-id> <test-id>
    yuantest test-history <test-id>