PHPackages                             fiunchinho/phpunit-randomizer - 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. fiunchinho/phpunit-randomizer

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

fiunchinho/phpunit-randomizer
=============================

Execute your test cases in random order, so you can check if they have hidden dependencies

v4.0.0(8y ago)50752.0k↓32.4%11[1 issues](https://github.com/fiunchinho/phpunit-randomizer/issues)18MITPHPPHP ^7.1

Since Aug 17Pushed 7y agoCompare

[ Source](https://github.com/fiunchinho/phpunit-randomizer)[ Packagist](https://packagist.org/packages/fiunchinho/phpunit-randomizer)[ Docs](https://armesto.net/)[ RSS](/packages/fiunchinho-phpunit-randomizer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (1)Versions (13)Used By (18)

phpunit-randomizer
==================

[](#phpunit-randomizer)

[PHPUnit has now similar features to this plugin already built-in](https://github.com/sebastianbergmann/phpunit/blob/master/ChangeLog-7.3.md#added), so you wouldn't need to use this plugin. To execute your tests in a random order just

```
vendor/bin/phpunit --order-by=random
```

You can pass a known seed to get the same order (useful when tests have failed in a certain order, so you can re-run the suite)

```
SEED=$(head -200 /dev/urandom | cksum | cut -f1 -d " ")
echo "Running tests with seed $SEED"
vendor/bin/phpunit --order-by=random --random-order-seed=$SEED
```

---

A PHPUnit extension that allows you to execute your test cases in a random order. This way you can identify tests that depend on other tests because they share some state, like object state, or even database state. PHPUnit has an option to execute test cases in process isolation, but that takes a lot of time when you have many tests.

With this library, you don't have to modify any PHPUnit code. Just install it, and use the binary from the vendor folder (`vendor/fiunchinho/phpunit-randomizer/bin/phpunit-randomizer`) to run your tests, instead of using the default phpunit command.

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

[](#installation)

```
composer require --dev fiunchinho/phpunit-randomizer

```

Usage
-----

[](#usage)

The executable binary is under the bin folder and it works exactly the same as the default phpunit file, accepting the same arguments, except for one: The `order` argument.

```
$ vendor/bin/phpunit-randomizer -h
```

When you execute your tests using this library, you will get the same results as using a regular PHPUnit installation unless you use the `--order rand` parameter. Try executing the following:

```
$ vendor/bin/phpunit-randomizer --order rand
```

If you look to the output, you'll see that it says that the tests have been randomized using a random seed. If you don't specify any seed (like the example above), the seed will be calculated randomly every time you execute your tests. But if you want to repeat an specific order that is interesting to you (because it failed, for example), you can re-run that order specifing the seed in your `order` argument.

For example, let's try to execute the example tests (that print the name of the test case so we can see the order in which they are executed) twice, and see how the order differ.

[![Executing randomly your tests](https://camo.githubusercontent.com/b5cf222452cbab119b491a5b414d4501b96951989f4c4cf0f2153156b672cee8/687474703a2f2f692e696d6775722e636f6d2f434d33526f517a2e706e67)](https://camo.githubusercontent.com/b5cf222452cbab119b491a5b414d4501b96951989f4c4cf0f2153156b672cee8/687474703a2f2f692e696d6775722e636f6d2f434d33526f517a2e706e67)

Here you can see how the order of the test cases is different in the two executions. Also, you can see the seed used in both cases (8639 in the first one, 4674 in the second). Now, if we want to repeat the order of the second execution, we can select the same seed.

[![Executing randomly your tests](https://camo.githubusercontent.com/732855a84114990692c0d3683e602fa352541097264cf18b6fd7ffbeeeadba35/687474703a2f2f692e696d6775722e636f6d2f7554577473704b2e706e67)](https://camo.githubusercontent.com/732855a84114990692c0d3683e602fa352541097264cf18b6fd7ffbeeeadba35/687474703a2f2f692e696d6775722e636f6d2f7554577473704b2e706e67)

As you can see, the order is exactly the same.

PHPUnit
-------

[](#phpunit)

- [PHPUnit Documentation](https://phpunit.de/manual/current/en/index.html)

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity48

Moderate usage in the ecosystem

Community29

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 81.3% 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 ~151 days

Recently: every ~309 days

Total

10

Last Release

2932d ago

Major Versions

1.0.2 → 2.0.02014-08-22

v2.0.3 → v3.0.02017-02-05

v3.0.1 → v4.0.02018-05-09

### Community

Maintainers

![](https://www.gravatar.com/avatar/e984bd1f50ca0b64c9e00548a6dcc87f36c42e6d74ae76b0b966e923797bda09?d=identicon)[fiunchinho](/maintainers/fiunchinho)

---

Top Contributors

[![fiunchinho](https://avatars.githubusercontent.com/u/627038?v=4)](https://github.com/fiunchinho "fiunchinho (61 commits)")[![prymas007](https://avatars.githubusercontent.com/u/1726010?v=4)](https://github.com/prymas007 "prymas007 (3 commits)")[![lolli42](https://avatars.githubusercontent.com/u/2178068?v=4)](https://github.com/lolli42 "lolli42 (2 commits)")[![sanmai](https://avatars.githubusercontent.com/u/139488?v=4)](https://github.com/sanmai "sanmai (2 commits)")[![andreassimon](https://avatars.githubusercontent.com/u/159943?v=4)](https://github.com/andreassimon "andreassimon (1 commits)")[![marc-casoliva](https://avatars.githubusercontent.com/u/14206270?v=4)](https://github.com/marc-casoliva "marc-casoliva (1 commits)")[![MPV](https://avatars.githubusercontent.com/u/62675?v=4)](https://github.com/MPV "MPV (1 commits)")[![janpapenbrock](https://avatars.githubusercontent.com/u/2108728?v=4)](https://github.com/janpapenbrock "janpapenbrock (1 commits)")[![ferjul17](https://avatars.githubusercontent.com/u/1574473?v=4)](https://github.com/ferjul17 "ferjul17 (1 commits)")[![Hendan](https://avatars.githubusercontent.com/u/7713721?v=4)](https://github.com/Hendan "Hendan (1 commits)")[![hiddewie](https://avatars.githubusercontent.com/u/1073881?v=4)](https://github.com/hiddewie "hiddewie (1 commits)")

---

Tags

phpphpunitphpunit-extensiontestingphpunitunit testing

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/fiunchinho-phpunit-randomizer/health.svg)

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

###  Alternatives

[phpunit/phpunit

The PHP Unit Testing framework.

20.0k910.7M134.8k](/packages/phpunit-phpunit)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[infection/infection

Infection is a Mutation Testing framework for PHP. The mutation adequacy score can be used to measure the effectiveness of a test set in terms of its ability to detect faults.

2.2k26.2M1.8k](/packages/infection-infection)[spatie/phpunit-snapshot-assertions

Snapshot testing with PHPUnit

69617.9M510](/packages/spatie-phpunit-snapshot-assertions)[dg/bypass-finals

Removes final keyword from source code on-the-fly and allows mocking of final methods and classes

57026.3M456](/packages/dg-bypass-finals)[donatj/mock-webserver

Simple mock web server for unit testing

1382.5M80](/packages/donatj-mock-webserver)

PHPackages © 2026

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