Something went wrong. Try again.
@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970@title Arcanist User Guide: Code Coverage@group userguideExplains code coverage features in Arcanist and Phorge.This is a configuration guide that helps you set up advanced features. If you'rejust getting started, you don't need to look at this yet. Instead, start withthe @{article:Arcanist User Guide}.Before you can configure coverage features, you must set up unit testintegration. For instructions, see @{article:Arcanist User Guide: Configuringa New Project} and @{article:Arcanist User Guide: CustomizingLint, Unit Tests and Workflows}.= Using Coverage Features =If your project has unit tests with coverage integration (see below forinstructions on setting it up), you can use "arc" to show coverage reports.For example: arc unit --detailed-coverage src/some/file.phpDepending on how your test engine is configured, this will run tests relevantto `src/some/file.php` and give you a detailed coverage report.If the test engine enables coverage by default, it will be uploaded toDifferential and displayed in the right gutter when viewing diffs.= Enabling Coverage for Arcanist and Phorge =If you're contributing, Arcanist and Phorge support coverage ifyou install Xdebug:http://xdebug.org/It should be sufficient to correctly install Xdebug; coverage information willbe automatically enabled.= Building Coverage Support =To add coverage support to a unit test engine, just call `setCoverage()` whenbuilding @{class@arcanist:ArcanistUnitTestResult} objects. Provide a map offile names (relative to the working copy root) to coverage report strings.Coverage report strings look like this: NNNNNCCCNNNNNNNNCCCCCCNNNUUUNNNNNEach line in the file is represented by a character. Valid characters are: - **N** Not executable. This is a comment or whitespace which should be ignored when computing test coverage. - **C** Covered. This line has test coverage. - **U** Uncovered. This line is executable but has no test coverage. - **X** Unreachable. If your coverage analysis can detect unreachable code, you can report it here.This format is intended to be as simple as possible. A valid coverage resultmight look like this: array( 'src/example.php' => 'NNCNNNCNUNNNUNUNUNUNUNC', 'src/other.php' => 'NNUNNNUNCNNNUNUNCNCNCNU', );You may also want to filter coverage information to the paths passed to theunit test engine. See @{class@arcanist:PhutilTestCase} and@{class@arcanist:PhutilUnitTestEngine} for an example of coverage integrationin PHP using Xdebug.