PHPackages                             phpunit/otr-report - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. phpunit/otr-report

ActiveProject[Testing &amp; Quality](/categories/testing)

phpunit/otr-report
==================

Generates reports from test result data in the Open Test Reporting (OTR) format produced by PHPUnit

1.0.1(1mo ago)625[1 issues](https://github.com/sebastianbergmann/phpunit-otr-report/issues)BSD-3-ClausePHPPHP &gt;=8.5CI passing

Since Jun 2Pushed 2w agoCompare

[ Source](https://github.com/sebastianbergmann/phpunit-otr-report)[ Packagist](https://packagist.org/packages/phpunit/otr-report)[ GitHub Sponsors](https://github.com/sebastianbergmann)[ Fund](https://liberapay.com/sebastianbergmann)[ RSS](/packages/phpunit-otr-report/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

[![CI Status](https://github.com/sebastianbergmann/phpunit-otr-report/workflows/CI/badge.svg)](https://github.com/sebastianbergmann/phpunit-otr-report/actions)[![codecov](https://camo.githubusercontent.com/5ed639c978d3ca0a35d705faa50a9da3054c95c9507f8d877d5a805bf8193cfb/68747470733a2f2f636f6465636f762e696f2f67682f73656261737469616e626572676d616e6e2f706870756e69742d6f74722d7265706f72742f6272616e63682f6d61696e2f67726170682f62616467652e7376673f746f6b656e3d30797a42554b38577269)](https://codecov.io/gh/sebastianbergmann/phpunit-otr-report)[![Latest Stable Version](https://camo.githubusercontent.com/c1a6b72d053c7e81a2ef952dff7fa734e35aababae797954757477d46d97f0ee/68747470733a2f2f706f7365722e707567782e6f72672f706870756e69742f6f74722d7265706f72742f76)](https://packagist.org/packages/phpunit/otr-report)[![Total Downloads](https://camo.githubusercontent.com/cf7d05f9764ec043b5d88ff98f6681087e1db8bc5b8cb77bdfcb3c4a09e60918/68747470733a2f2f706f7365722e707567782e6f72672f706870756e69742f6f74722d7265706f72742f646f776e6c6f616473)](https://packagist.org/packages/phpunit/otr-report/stats)[![Monthly Downloads](https://camo.githubusercontent.com/cd180be14887471cb88929fad580de764cf9dad74b43542d96afd6e60913df24/68747470733a2f2f706f7365722e707567782e6f72672f706870756e69742f6f74722d7265706f72742f642f6d6f6e74686c79)](https://packagist.org/packages/phpunit/otr-report/stats)[![Daily Downloads](https://camo.githubusercontent.com/5e1ea83d875910b83c813b367c5e5dc805364a343a57e87ea801a2be41f67d62/68747470733a2f2f706f7365722e707567782e6f72672f706870756e69742f6f74722d7265706f72742f642f6461696c79)](https://packagist.org/packages/phpunit/otr-report/stats)

otr-report
==========

[](#otr-report)

This tool generates reports from test result data in the Open Test Reporting (OTR) format produced by PHPUnit &gt;= 13.2.

> **Note:** [Open Test Reporting](https://github.com/ota4j-team/open-test-reporting) is language-agnostic and tool-agnostic. This tool, however, is specialised for the OTR XML produced by PHPUnit 13.2 and newer, which contains additional information specific to PHP and PHPUnit.

Installation
------------

[](#installation)

This tool is distributed as a [PHP Archive (PHAR)](https://php.net/phar):

```
$ wget https://phar.phpunit.de/otr-report-X.Y.phar

$ php otr-report-X.Y.phar --version
```

Please replace `X.Y` with the version of otr-report you are interested in.

Using [Phive](https://phar.io/) is the recommended way for managing the tool dependencies of your project:

```
$ phive install otr-report

$ ./tools/otr-report --version

```

**[It is not recommended to use Composer to download and install this tool.](https://phpunit.readthedocs.io/en/13.1/installation.html#phar-or-composer)**

Generating OTR data
-------------------

[](#generating-otr-data)

This tool operates on test result data that PHPUnit writes in the Open Test Reporting (OTR) XML format.

Use PHPUnit's `--log-otr` option to write an OTR XML logfile for a test-suite run:

```
$ phpunit --log-otr /tmp/otr/run.xml

```

The logfile records, among other things, how long each test took to run.

Usage
-----

[](#usage)

### Listing the slowest tests

[](#listing-the-slowest-tests)

The `otr-report slowest` command reads the OTR XML logfile of a single test-suite run and prints the ten slowest tests, ordered from slowest to fastest.

This is useful for finding the tests that dominate the runtime of your test suite.

Use the `--limit` option to list a different number of tests; it defaults to `10`.

#### Example

[](#example)

```
$ otr-report slowest /tmp/otr/run.xml
otr-report 1.0.1 by Sebastian Bergmann.

Time(s)   Test
-------   ----
4.441529  SebastianBergmann\Raytracer\PuttingItTogetherTest::test_chapter_8
3.771325  SebastianBergmann\Raytracer\PuttingItTogetherTest::test_chapter_6
1.375265  SebastianBergmann\Raytracer\PuttingItTogetherTest::test_chapter_5
0.845473  SebastianBergmann\Raytracer\PuttingItTogetherTest::test_chapter_10
0.039408  SebastianBergmann\Raytracer\PuttingItTogetherTest::test_chapter_4
0.023849  SebastianBergmann\Raytracer\CameraTest::test_rendering_a_world_with_a_camera
0.000839  SebastianBergmann\Raytracer\StripePatternTest::test_a_stripe_pattern_alternates_in_x
0.000744  SebastianBergmann\Raytracer\RingPatternTest::test_a_ring_should_extend_in_both_x_and_z
0.000707  SebastianBergmann\Raytracer\GradientPatternTest::test_a_gradient_linearly_interpolates_between_colors
0.000688  SebastianBergmann\Raytracer\CheckersPatternTest::test_checkers_should_repeat_in_x

```

#### The `--above-mean` option

[](#the---above-mean-option)

With the `--above-mean` option, the report first calculates the mean runtime across all tests and then lists only the tests that are slower than the mean. Each listed test is annotated with a factor that shows how many times slower than the mean it is.

```
$ otr-report slowest --above-mean /tmp/otr/run.xml
otr-report 1.0.1 by Sebastian Bergmann.

Mean test runtime: 0.059520 s (177 tests, 4 slower than mean)

 Time(s)    x mean  Test
 -------    ------  ----
4.441529    74.62x  SebastianBergmann\Raytracer\PuttingItTogetherTest::test_chapter_8
3.771325    63.36x  SebastianBergmann\Raytracer\PuttingItTogetherTest::test_chapter_6
1.375265    23.11x  SebastianBergmann\Raytracer\PuttingItTogetherTest::test_chapter_5
0.845473    14.20x  SebastianBergmann\Raytracer\PuttingItTogetherTest::test_chapter_10

```

#### The `--limit` option

[](#the---limit-option)

By default, the ten slowest tests are listed. Use the `--limit` option to list a different number of tests:

```
$ otr-report slowest --limit 3 /tmp/otr/run.xml
otr-report 1.0.1 by Sebastian Bergmann.

Time(s)   Test
-------   ----
4.441529  SebastianBergmann\Raytracer\PuttingItTogetherTest::test_chapter_8
3.771325  SebastianBergmann\Raytracer\PuttingItTogetherTest::test_chapter_6
1.375265  SebastianBergmann\Raytracer\PuttingItTogetherTest::test_chapter_5

```

The option also applies to `--above-mean`. The value must be a positive integer.

#### The `--sort` option

[](#the---sort-option)

By default, tests are sorted by their wall-clock runtime. Use the `--sort` option to sort by a different metric:

- `time` (default) sorts by wall-clock runtime (the `time` attribute), in seconds
- `cpu` sorts by CPU time (the `cpuTime` attribute, i.e. user plus system CPU time), in seconds
- `memory` sorts by peak memory usage (the `peakMemoryUsage` attribute), in bytes

```
$ otr-report slowest --sort memory --limit 3 /tmp/otr/run.xml
otr-report 1.0.1 by Sebastian Bergmann.

Memory    Test
-------   ----
23489616  SebastianBergmann\Raytracer\PuttingItTogetherTest::test_chapter_6
22907872  SebastianBergmann\Raytracer\PuttingItTogetherTest::test_chapter_4
22044384  SebastianBergmann\Raytracer\PuttingItTogetherTest::test_chapter_5

```

The option combines with `--above-mean`, which then lists the tests beyond the mean of the chosen metric.

### Generating a trend report

[](#generating-a-trend-report)

The `otr-report trends` command reads all OTR XML logfiles in a directory and generates a single HTML report that visualizes how your test suite evolves across runs.

This is useful for tracking the runtime and the number of tests of your test suite over time, for example by archiving one OTR XML logfile per CI run into a shared directory.

The generated HTML report includes:

- The total runtime of the test suite across all runs, as a chart
- The number of tests across all runs, as a chart
- The ten slowest tests of the most recent run, each with a sparkline of its runtime across all runs and the change relative to its first recorded runtime
- A table of all runs, with their start time, total runtime, and number of tests

The runs are ordered by their start time, which is read from the OTR XML logfiles.

#### Example

[](#example-1)

Collect one OTR XML logfile per run into a directory:

```
$ phpunit --log-otr /tmp/otr/2026-02-02.xml
$ phpunit --log-otr /tmp/otr/2026-02-09.xml
$ phpunit --log-otr /tmp/otr/2026-02-16.xml

```

Then generate the trend report:

```
$ otr-report trends /tmp/otr /tmp/trends.html
otr-report 1.0.1 by Sebastian Bergmann.

Wrote trends report to /tmp/trends.html

```

The first argument is the directory containing the OTR XML logfiles, the second argument is the HTML file the trend report is written to.

### Generating a test results report

[](#generating-a-test-results-report)

The `otr-report results` command reads the OTR XML logfile of a single test-suite run and generates a self-contained HTML report that visualises the outcome of every test.

The generated HTML report includes:

- A summary of the run (total tests, status counts, total runtime, and the number of reported issues)
- A sticky sidebar with a collapsible tree that groups tests by namespace, then class, then method, with a status indicator at every level
- One collapsible section per test class, headed by the worst status in the class
- For each test: its status (`SUCCESSFUL`, `FAILED`, `ERRORED`, `ABORTED`, or `SKIPPED`), runtime, reason, throwable, and any reported issues such as `risky`

Tests that did not pass are expanded by default; successful tests are collapsed. Clicking a class or method in the sidebar scrolls to its entry in the main pane.

#### Example

[](#example-2)

```
$ otr-report results /tmp/otr/run.xml /tmp/results.html
otr-report 1.0.1 by Sebastian Bergmann.

Wrote test results report to /tmp/results.html

```

The first argument is the OTR XML logfile, the second argument is the HTML file the report is written to.

#### The `--testdox` option

[](#the---testdox-option)

By default, the report identifies each test class and each test method by its PHP name. With the `--testdox` option, the report uses the TestDox information (the prettified class and method names that PHPUnit records in the OTR XML logfile) instead. When a test does not have TestDox information, the original class or method name is used as a fallback.

```
$ otr-report results --testdox /tmp/otr/run.xml /tmp/results.html

```

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance90

Actively maintained with recent releases

Popularity15

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 89.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

52d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1089?v=4)[Sebastian Probst Eide](/maintainers/sebastian)[@sebastian](https://github.com/sebastian)

---

Top Contributors

[![sebastianbergmann](https://avatars.githubusercontent.com/u/25218?v=4)](https://github.com/sebastianbergmann "sebastianbergmann (61 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (7 commits)")

### Embed Badge

![Health badge](/badges/phpunit-otr-report/health.svg)

```
[![Health](https://phpackages.com/badges/phpunit-otr-report/health.svg)](https://phpackages.com/packages/phpunit-otr-report)
```

###  Alternatives

[phpunit/phpunit

The PHP Unit Testing framework.

20.0k955.1M159.1k](/packages/phpunit-phpunit)[phpunit/php-code-coverage

Library that provides collection, processing, and rendering functionality for PHP code coverage information.

8.9k935.9M1.7k](/packages/phpunit-php-code-coverage)[phpunit/phpcov

CLI frontend for php-code-coverage

23922.8M678](/packages/phpunit-phpcov)[systemsdk/phpcpd

Copy/Paste Detector for PHP code

11101.2k13](/packages/systemsdk-phpcpd)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
