PHPackages                             twada/phpunit-size-distribution - 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. twada/phpunit-size-distribution

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

twada/phpunit-size-distribution
===============================

A PHPUnit extension that measures and reports test size distribution (Small/Medium/Large)

v0.1.0(5mo ago)132.4k[2 PRs](https://github.com/twada/phpunit-size-distribution/pulls)MITPHPPHP ^8.1CI passing

Since Jan 17Pushed 3w ago1 watchersCompare

[ Source](https://github.com/twada/phpunit-size-distribution)[ Packagist](https://packagist.org/packages/twada/phpunit-size-distribution)[ Docs](https://github.com/twada/phpunit-size-distribution)[ RSS](/packages/twada-phpunit-size-distribution/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (5)Versions (6)Used By (0)

phpunit-size-distribution
=========================

[](#phpunit-size-distribution)

[![CI](https://github.com/twada/phpunit-size-distribution/actions/workflows/ci.yml/badge.svg)](https://github.com/twada/phpunit-size-distribution/actions/workflows/ci.yml)[![codecov](https://camo.githubusercontent.com/f74defa5ef43025d46d1c2f6702c5faae7da1d423e58c0d637159c3c5e6bf64d/68747470733a2f2f636f6465636f762e696f2f67682f74776164612f706870756e69742d73697a652d646973747269627574696f6e2f67726170682f62616467652e7376673f746f6b656e3d42574d35493934444948)](https://codecov.io/gh/twada/phpunit-size-distribution)[![Latest Stable Version](https://camo.githubusercontent.com/c89482cef1f9bf3035ddc53e3f0274796ec04f2eeee50e691c0d55bd485a99d5/68747470733a2f2f706f7365722e707567782e6f72672f74776164612f706870756e69742d73697a652d646973747269627574696f6e2f76)](https://packagist.org/packages/twada/phpunit-size-distribution)[![PHP Version](https://camo.githubusercontent.com/351755b1ea3b8a079461d461cd8142582eb91df14fea214307a660632576b07a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d382e312532422d626c7565)](https://camo.githubusercontent.com/351755b1ea3b8a079461d461cd8142582eb91df14fea214307a660632576b07a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d382e312532422d626c7565)[![PHPUnit Version](https://camo.githubusercontent.com/5a0ae66b1a9c5384b9e12057d5d20807413ab439cba8a7a5543ea50481eb71c1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f706870756e69742d31302e3525324225323025374325323031312e7825323025374325323031322e782d626c7565)](https://camo.githubusercontent.com/5a0ae66b1a9c5384b9e12057d5d20807413ab439cba8a7a5543ea50481eb71c1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f706870756e69742d31302e3525324225323025374325323031312e7825323025374325323031322e782d626c7565)[![PHPStan Level](https://camo.githubusercontent.com/44dc5f71fec76653887c975fe3db546a82ff603d094798eb6414a38369db1f44/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068707374616e2d6c6576656c253230382d627269676874677265656e)](https://camo.githubusercontent.com/44dc5f71fec76653887c975fe3db546a82ff603d094798eb6414a38369db1f44/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068707374616e2d6c6576656c253230382d627269676874677265656e)[![License](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)](LICENSE)

A PHPUnit extension that measures and reports test size distribution (Small/Medium/Large).

Overview
--------

[](#overview)

PHPUnit supports test size classification through `#[Small]`, `#[Medium]`, and `#[Large]` attributes. This extension analyzes your test suite and reports the distribution of test sizes, helping you maintain a healthy test pyramid.

Requirements
------------

[](#requirements)

- PHP 8.1+
- PHPUnit 10.5+ / 11.x / 12.x

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

[](#installation)

```
composer require --dev twada/phpunit-size-distribution
```

Configuration
-------------

[](#configuration)

Register the extension in your `phpunit.xml`:

```

```

Usage
-----

[](#usage)

Run your tests as usual:

```
vendor/bin/phpunit
```

After test execution, you'll see a report like this:

```
Test Size Distribution
======================
Small:   5 tests ( 62.5%)
Medium:  1 tests ( 12.5%)
Large:   1 tests ( 12.5%)
None:    1 tests ( 12.5%)
----------------------
Total:   8 tests

```

Test Size Categories
--------------------

[](#test-size-categories)

CategoryDescriptionSmallTests marked with `#[Small]` attributeMediumTests marked with `#[Medium]` attributeLargeTests marked with `#[Large]` attributeNoneTests without any size attribute### Example

[](#example)

```
