Skip to main content
Skip to content

Viewing code coverage for your repository

Track whether code coverage on your default branch is improving or regressing over time.

Кто может использовать эту функцию?

Пользователи с доступом на запись

GitHub Team или GitHub Enterprise Cloud

Примечание.

The repository coverage overview is in Публичный предварительный просмотр and subject to change.

Prerequisites

Viewing code coverage

The Code coverage overview shows a snapshot of your repository's coverage at a glance, highlighting the current line coverage and trends over time.

  1. Перейдите на Security and quality вкладку вашего репозитория.
  2. Нажмите, чтобы развернуть Качество кода, затем нажмите Стандартные выводы.
  3. In the top right corner of the "Code coverage" score card, click View insights.
  4. To understand current coverage on your default branch, review the "Total line coverage" percentage:
    • The line coverage percentage represents the number of lines covered by tests divided by the total number of executable lines, expressed as a percentage. If you upload multiple reports, each line is counted once. See How total line coverage is calculated.
    • If a coverage goal is set, compare this percentage with the goal to see whether your coverage meets it.
  5. To see whether coverage is improving or declining over time, review the "Line coverage over time" line graph. Use the time period dropdown to select the last 14, 30, or 90 days.
  6. Optionally, to filter the results, use both the language and label filters to select the coverage you want to review. You must use both filters.
  7. To set a coverage goal, to the right of "Total line coverage", click and enter the desired percentage.

Next steps

To improve coverage in the files that need it most, use Copilot to write tests. See Тестирование кода.