sebastianbergmann / sebastianbergmann/php-code-coverage

Add branch coverage statistics to XML report output

Open
#1,056 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

report/xml type/enhancement
Dominant language
PHP
Stars
8.9k
Forks
385
Avg merge
12h 25m
Merged PRs (30d)
31

Description

Q A
php-code-coverage version 10.1.16
PHP version 8.3.2
Driver Xdebug
Xdebug version 3.3.1
Installation Method Composer
Usage Method PHPUnit
PHPUnit version (if used) 10.5.37

I'm the maintainer of a VS Code extension that integrates PHPUnit with the VS Code Test Explorer, and I'd like to update it to support the new feature that allows individual tests to be associated with test coverage lines.

Currently, I'm using the Clover XML report to pick up code coverage statistics, which has been working well. However, it doesn't include the detail of which specific test covered each line. From what I can tell, the Clover XSD schema will not support adding this type of detail.

The PHPUnit XML report does include associations of tests to individual line coverage. However, the XML report does not seem to use branch coverage statistics, even when they are available.

Is there any plan to enhance the XML report to include branch coverage statistics? I am happy to put together a PR if that helps.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the PHPUnit XML report generation and how branch coverage data is represented in the coverage model. Compare the existing line-coverage and test-association output with the available branch statistics. Done means the XML report includes branch coverage statistics without losing individual test-to-line associations, with the report remaining compatible with its schema constraints.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
testing-qa
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.