Skip to main content
Cypress云服务企业套餐

数据提取API

info
您将学习到
  • 如何使用Cypress Cloud API提取测试数据
  • 可用于数据提取的API端点
  • 如何使用API获取CSV、JSON或XLSX格式的数据
  • 如何获取特定日期范围内的数据

企业级报告数据可通过Cypress Cloud API从云端下载。返回的数据支持多种文件格式,便于集成到BI报告平台,同时提供可编程解析的JSON文件。该API支持获取多层次的测试数据,包括包含状态、错误信息、运行标签和分组、测试回放链接等详细信息的单个测试结果数据。

所有在企业级报告中可见的数据均可通过此API获取。

tip

Cypress Cloud高级功能

数据提取API仅适用于订阅了 企业版Cypress Cloud计划的用户。

API概览

报告数据通过Cloud中的API密钥访问。在Cypress Cloud中进入集成→企业API,复制为您的组织创建的API密钥。无需额外启用功能,只要订阅了企业版Cypress Cloud计划,通过API访问测试数据的功能即已激活。

Cloud企业级报告API下载数据


注意事项:

  • 企业级报告中的数据非实时显示。聚合数据基于UTC时间当天午夜更新,即数据更新至"昨日结束"。但单个结果数据接近实时,运行完成后30分钟内可用。返回近实时数据的端点如下所述。
  • 历史数据可用性取决于Cypress Cloud中的数据保留期限。

API端点详情

使用以下API端点。将YOUR-API-KEY替换为您的API密钥,report_id指定要检索的数据类型。

https://cloud.cypress.io/enterprise-reporting/report?token=YOUR-API-KEY&report_id=REPORT-TYPE&export_format=csv

可用查询参数:

  • start_date。必填,格式为yyyy-MM-dd或yyyy-MM-ddTHH:mm:ss

    例如,请求2025年1月1日的开始日期:?start_date=2025-01-01。请求当天UTC时间12:30的开始时间:?start_date=2025-01-01T12%3A30%3A00

  • end_date。可选,格式同上。未指定时默认为当天。

    例如,请求2025年3月1日的结束日期:?end_date=2025-03-01。请求当天UTC时间12:30的结束时间:?end_date=2025-03-01T12%3A30%3A00

  • projects。可选,接受Cypress项目名称,需URL编码。可传递多个项目参数。

    例如,筛选项目_Project e2e_和_Phoenix_:&projects=Project%20e2e&projects=Phoenix

  • branch。可选,接受提交分支名称,需URL编码。可传递多个分支参数。

    例如,筛选分支_develop_和_commitBranch1_:&branch=develop&branch=commitBranch1

  • export_format。指定返回数据的文件格式,有效选项:csvjsonxlsx

    例如,请求JSON格式:&export_format=json

使用情况与项目

项目列表

获取自start_date以来在Cypress Cloud中记录测试的所有项目列表。返回的ID用于Cypress Cloud中项目级分析页面的URL链接生成。

report_id:project-list

返回数据包括:

  • project_name
  • id

示例: https://cloud.cypress.io/enterprise-reporting/report?token=YOUR-API-KEY&report_id=project-list&export_format=csv&start_date=2025-03-01

各项目测试数量

了解组织中各项目的测试使用情况,返回各项目的简单汇总。

report_id:usage-per-project-summary

返回数据包括:

  • project_name
  • test_run_count

示例: https://cloud.cypress.io/enterprise-reporting/report?token=YOUR-API-KEY&report_id=usage-per-project-summary&export_format=csv&start_date=2025-03-01

各项目测试数量趋势

了解组织中各项目的测试使用情况随时间的变化。

report_id:usage-per-project-over-time

返回数据包括:

  • project_name
  • test_run_count
  • week
  • day

示例: https://cloud.cypress.io/enterprise-reporting/report?token=YOUR-API-KEY&report_id=usage-per-project-over-time&export_format=csv&start_date=2025-03-01

Cypress测试类型

了解组织内端到端测试和组件测试的采用情况。

report_id:cypress-test-types

返回数据包括:

  • testing_type (e2e或component)
  • total_tests
  • total_e2e
  • total_ct
  • week
  • day

示例: https://cloud.cypress.io/enterprise-reporting/report?token=YOUR-API-KEY&report_id=cypress-test-types&export_format=csv&start_date=2025-03-01

Cypress测试套件规模

了解组织中所有项目的测试套件规模增长情况。计算每次运行的平均测试用例数,排除因错误或超时导致的运行。

report_id:test-suite-size-summary

返回数据包括:

  • total_tests
  • total_e2e
  • total_ct
  • week

示例: https://cloud.cypress.io/enterprise-reporting/report?token=YOUR-API-KEY&report_id=test-suite-size-summary&export_format=csv&start_date=2025-03-01

Cypress测试套件规模趋势

了解测试套件规模随时间的变化。

report_id:test-suite-size-over-time

返回数据包括:

  • project_name
  • total_tests
  • total_e2e
  • total_ct
  • week

示例: https://cloud.cypress.io/enterprise-reporting/report?token=YOUR-API-KEY&report_id=test-suite-size-over-time&export_format=csv&start_date=2025-03-01

项目测试数量与状态

提取项目级别的运行状态汇总数据,随时间变化。

report_id:status-per-test-daily

返回数据包括:

  • project_name
  • status
  • test_run_count
  • week
  • day

示例: https://cloud.cypress.io/enterprise-reporting/report?token=YOUR-API-KEY&report_id=status-per-test-daily&export_format=csv&start_date=2025-03-01

运行状态

按运行状态

了解运行级别的成功与失败率。若运行任何部分失败,则整个运行视为失败。

report_id:status-per-build-summary

返回数据包括:

  • status
  • test_run_count

示例: https://cloud.cypress.io/enterprise-reporting/report?token=YOUR-API-KEY&report_id=status-per-build-summary&export_format=csv&start_date=2025-03-01

按运行状态趋势

了解运行级别的成功与失败率随时间变化。

report_id:status-per-build-over-time

返回数据包括:

  • status
  • test_run_count
  • week
  • day

示例: https://cloud.cypress.io/enterprise-reporting/report?token=YOUR-API-KEY&report_id=status-per-build-over-time&export_format=csv&start_date=2025-03-01

按规格状态

了解规格级别的成功与失败率。若规格任何部分失败,则整个规格视为失败。

report_id:status-per-spec-summary

返回数据包括:

  • status
  • test_run_count

示例: https://cloud.cypress.io/enterprise-reporting/report?token=YOUR-API-KEY&report_id=status-per-spec-summary&export_format=csv&start_date=2025-03-01

按规格状态趋势

了解规格级别的成功与失败率随时间变化。

report_id:status-per-spec-over-time

返回数据包括:

  • status
  • test_run_count
  • week
  • day

示例: https://cloud.cypress.io/enterprise-reporting/report?token=YOUR-API-KEY&report_id=status-per-spec-over-time&export_format=csv&start_date=2025-03-01

按测试运行状态

了解单个测试级别的成功与失败率。

report_id:status-per-test-summary

返回数据包括:

  • failed
  • passed

示例: https://cloud.cypress.io/enterprise-reporting/report?token=YOUR-API-KEY&report_id=status-per-test-summary&export_format=csv&start_date=2025-03-01

按测试运行状态趋势

了解单个测试级别的成功与失败率随时间变化。

report_id:status-per-test-over-time

返回数据包括:

  • project_name
  • test_run_count
  • week
  • status

示例: https://cloud.cypress.io/enterprise-reporting/report?token=YOUR-API-KEY&report_id=status-per-test-over-time&export_format=csv&start_date=2025-03-01

版本与浏览器

Cypress运行版本

监控组织中使用的Cypress应用版本。

report_id:cypress-build-versions-summary

返回数据包括:

  • run_count
  • cypress_version

示例: https://cloud.cypress.io/enterprise-reporting/report?token=YOUR-API-KEY&report_id=cypress-build-versions-summary&export_format=csv&start_date=2025-03-01

Cypress运行版本趋势

监控组织中使用的Cypress应用版本随时间变化。

report_id:cypress-build-versions-over-time

返回数据包括:

  • run_count
  • cypress_version
  • week

示例: https://cloud.cypress.io/enterprise-reporting/report?token=YOUR-API-KEY&report_id=cypress-build-versions-over-time&export_format=csv&start_date=2025-03-01

各项目Cypress运行版本趋势

监控各项目中使用的Cypress应用版本随时间变化。

report_id:cypress-build-versions-per-project-over-time

返回数据包括:

  • project_name
  • run_count
  • cypress_version
  • week

示例: https://cloud.cypress.io/enterprise-reporting/report?token=YOUR-API-KEY&report_id=cypress-build-versions-per-project-over-time&export_format=csv&start_date=2025-03-01

测试浏览器

监控组织中测试的浏览器类型。

report_id:browsers-tested

返回数据包括:

  • spec_count
  • browser

示例: https://cloud.cypress.io/enterprise-reporting/report?token=YOUR-API-KEY&report_id=browsers-tested&export_format=csv&start_date=2025-03-01

浏览器版本测试

监控组织中测试的浏览器具体版本。

report_id:browser-versions

返回数据包括:

  • spec_count
  • browser
  • version

示例: https://cloud.cypress.io/enterprise-reporting/report?token=YOUR-API-KEY&report_id=browser-versions&export_format=csv&start_date=2025-03-01

浏览器版本测试趋势

监控组织中测试的浏览器具体版本随时间变化。

report_id:browser-versions-over-time

返回数据包括:

  • spec_count
  • browser
  • version
  • day
  • week

示例: https://cloud.cypress.io/enterprise-reporting/report?token=YOUR-API-KEY&report_id=browser-versions-over-time&export_format=csv&start_date=2025-03-01

各项目浏览器版本测试趋势

监控各项目中测试的浏览器具体版本随时间变化。

report_id:browser-versions-per-project-over-time

返回数据包括:

  • project_name
  • spec_count
  • browser
  • version
  • day
  • week

示例: https://cloud.cypress.io/enterprise-reporting/report?token=YOUR-API-KEY&report_id=browser-versions-per-project-over-time&export_format=csv&start_date=2025-03-01

测试级数据

以下API的数据在运行完成后30分钟内接近实时可用。

单个规格结果

提取所有规格结果,无论状态如何。单次请求最多返回500,000条记录,超过需分多次请求。

report_id:spec-details

返回数据包括:

  • project_name
  • created_at (日期和时间)
  • run_number
  • commit_author_name
  • spec (路径和文件名)
  • status
  • total_tests
  • pass_tests
  • flaky_tests
  • fail_tests
  • parallel_enabled
  • commit_branch
  • group_name
  • failed_spec_prioritized
  • spec_duration (毫秒)
  • browser_name
  • browser_version
  • os_name
  • os_version

示例: https://cloud.cypress.io/enterprise-reporting/report?token=YOUR-API-KEY&report_id=spec-details&export_format=csv&start_date=2025-03-01

单个失败测试结果

提取所有失败测试的详细结果。单次请求最多返回500,000条记录。

report_id:failed-test-details

返回数据包括:

  • project_name
  • created_at (日期和时间)
  • run_number
  • commit_author_name
  • commit_branch
  • commit_sha
  • ci_build_id
  • status
  • group_name
  • run_tags (字符串数组)
  • error_name (字符串数组)
  • error_message (字符串数组)
  • test_replay_url
  • spec (路径和文件名)
  • test_name (测试名称与Cypress Cloud显示一致,使用'///'分隔片段)

示例: https://cloud.cypress.io/enterprise-reporting/report?token=YOUR-API-KEY&report_id=failed-test-details&export_format=csv&start_date=2025-03-01

单个测试结果

提取所有测试的详细结果,无论状态如何。单次请求最多返回500,000条记录。

report_id:test-details

返回数据包括:

  • project_name
  • created_at (日期和时间)
  • run_number
  • commit_author_name
  • commit_branch
  • commit_sha
  • ci_build_id
  • status
  • group_name
  • run_tags (字符串数组)
  • test_duration
  • error_name (字符串数组)
  • error_message (字符串数组)
  • test_replay_url
  • spec (路径和文件名)
  • test_name (测试名称与Cypress Cloud显示一致,使用'///'分隔片段)

示例: https://cloud.cypress.io/enterprise-reporting/report?token=YOUR-API-KEY&report_id=test-details&export_format=csv&start_date=2025-03-01

运行时长

平均运行时长趋势

获取通过运行的平均、中位数、最小和最大时长,随时间变化。

report_id:average-passing-build-duration

返回数据包括:

  • project_name
  • run_count
  • avg_pass_run_duration (平均)
  • mdn_pass_run_duration (中位数)
  • min_pass_run_duration (最小)
  • max_pass_run_duration (最大)
  • day
  • week

示例: https://cloud.cypress.io/enterprise-reporting/report?token=YOUR-API-KEY&report_id=average-passing-build-duration&export_format=csv&start_date=2025-03-01

平均规格时长趋势

获取规格的平均、中位数、最小和最大时长,随时间变化。单次请求最多返回500,000条记录。

report_id:average-passing-spec-duration

返回数据包括:

  • project_name
  • spec (路径和文件名)
  • spec_count
  • avg_pass_spec_duration (平均)
  • mdn_pass_spec_duration (中位数)
  • min_pass_spec_duration (最小)
  • max_pass_spec_duration (最大)
  • day
  • week

示例: https://cloud.cypress.io/enterprise-reporting/report?token=YOUR-API-KEY&report_id=average-passing-spec-duration&export_format=csv&start_date=2025-03-01

波动测试

测试波动详情趋势

识别组织中波动测试的发生情况及其随时间变化。

report_id:flake-per-project-over-time

返回数据包括:

  • project_name
  • flaky_test_count
  • week
  • day

示例: https://cloud.cypress.io/enterprise-reporting/report?token=YOUR-API-KEY&report_id=flake-per-project-over-time&export_format=csv&start_date=2025-03-01

各项目波动率

了解项目的波动率而非波动次数。波动率以整数表示,例如:4次运行中1次波动,波动率为25。

report_id:flake-rate-per-project

返回数据包括:

  • project_name
  • flaky_test_count
  • pass_test_count
  • flaky_rate

示例: https://cloud.cypress.io/enterprise-reporting/report?token=YOUR-API-KERY&report_id=flake-rate-per-project&export_format=csv&start_date=2025-03-01

各项目波动率趋势

了解项目的波动率随时间变化。

report_id:flake-rate-per-project-over-time

返回数据包括:

  • project_name
  • flaky_test_count
  • pass_test_count
  • flaky_rate
  • day
  • week

示例: https://cloud.cypress.io/enterprise-reporting/report?token=YOUR-API-KEY&report_id=flake-rate-per-project-over-time&export_format=csv&start_date=2025-03-01

波动测试详情

提取所有波动测试的详细结果。单次请求最多返回500,000条记录。

report_id:flaky-test-details

返回数据包括:

  • project_name
  • created_at (日期和时间)
  • run_number
  • commit_author_name
  • commit_branch
  • commit_sha
  • ci_build_id
  • status
  • group_name
  • run_tags (字符串数组)
  • error_name (字符串数组)
  • error_message (字符串数组)
  • test_replay_url

示例: https://cloud.cypress.io/enterprise-reporting/report?token=YOUR-API-KEY&report_id=flaky-test-details&export_format=csv&start_date=2025-03-01

各项目顶部波动测试

了解波动次数最高的测试,并提供最近波动示例的URL链接,便于直接跳转至Cypress Cloud进行问题排查。

report_id:top-flaky-per-project

返回数据包括:

  • project_name
  • flaky_count
  • spec (路径和文件名)
  • test_replay_url

示例: https://cloud.cypress.io/enterprise-reporting/report?token=YOUR-API-KEY&report_id=top-flaky-per-project&export_format=csv&start_date=2025-03-01

聚合数据

各项目顶部失败

了解失败次数最高的测试,并提供最近失败示例的URL链接。失败率以整数表示,例如:4次运行中1次失败,失败率为25。

report_id:top-failures-per-project

返回数据包括:

  • project_name
  • cnt_passed
  • cnt_failed
  • cnt_total
  • fail_rate
  • spec (路径和文件名)
  • test_replay_url

示例: https://cloud.cypress.io/enterprise-reporting/report?token=YOUR-API-KEY&report_id=top-failures-per-project&export_format=csv&start_date=2025-03-01

各项目顶部错误

了解错误次数最高的测试,按错误类型和消息分组,并提供最近错误示例的URL链接。

report_id:top-errors-per-project

返回数据包括:

  • project_name
  • test_result_uuid (Cypress Cloud中测试的唯一ID,可直接生成URL)
  • error_type
  • error_message
  • error_count
  • test_replay_url

示例: https://cloud.cypress.io/enterprise-reporting/report?token=YOUR-API-KEY&report_id=top-errors-per-project&export_format=csv&start_date=2025-03-01

UI覆盖率

了解更多关于Cypress UI覆盖率此处

各项目UI覆盖率

了解组织中各项目的UI覆盖率百分比情况。

report_id:ui-coverage-per-project-summary

返回数据包括:

  • project_name
  • ui_coverage_pct

示例: https://cloud.cypress.io/enterprise-reporting/report?token=YOUR-API-KEY&report_id=ui-coverage-per-project-summary&export_format=csv&start_date=2025-03-01

各项目UI覆盖率趋势

了解UI覆盖率百分比随时间的变化。

report_id:ui-coverage-per-project-over-time

返回数据包括:

  • project_name
  • ui_coverage_pct
  • week
  • day

示例: https://cloud.cypress.io/enterprise-reporting/report?token=YOUR-API-KEY&report_id=ui-coverage-per-project-over-time&export_format=csv&start_date=2025-03-01

UI覆盖率详情

提取每次运行的UI覆盖率百分比及其他属性。单次请求最多返回500,000条记录。

report_id:ui-coverage-details

返回数据包括:

  • project_name
  • created_at (日期和时间)
  • run_number
  • status
  • ui_coverage_pct
  • commit_author_name
  • commit_branch
  • ci_build_id
  • run_tags (字符串数组)

示例: https://cloud.cypress.io/enterprise-reporting/report?token=YOUR-API-KEY&report_id=ui-coverage-details&export_format=csv&start_date=2025-03-01

Cypress无障碍测试

了解更多关于Cypress无障碍测试此处

各项目无障碍评分

了解组织中各项目的无障碍评分情况。

report_id:accessibility-per-project-summary

返回数据包括:

  • project_name
  • accessibility_score

示例: https://cloud.cypress.io/enterprise-reporting/report?token=YOUR-API-KEY&report_id=accessibility-per-project-summary&export_format=csv&start_date=2025-03-01

各项目无障碍评分趋势

了解无障碍评分随时间的变化。

report_id:accessibility-per-project-over-time

返回数据包括:

  • project_name
  • accessibility_score
  • week
  • day

示例: https://cloud.cypress.io/enterprise-reporting/report?token=YOUR-API-KEY&report_id=accessibility-per-project-over-time&export_format=csv&start_date=2025-03-01

无障碍评分详情

提取每次运行的无障碍评分及其他属性。单次请求最多返回500,000条记录。

report_id:accessibility-details

返回数据包括:

  • project_name
  • created_at (日期和时间)
  • run_number
  • status
  • accessibility_score
  • commit_author_name
  • commit_branch
  • ci_build_id
  • run_tags (字符串数组)

示例: https://cloud.cypress.io/enterprise-reporting/report?token=YOUR-API-KEY&report_id=accessibility-details&export_format=csv&start_date=2025-03-01