Sunday, May 22, 2016

In the period before my move to Cambridge I got some time to work on Eris, and to use it to test the guts of Onebip's infrastructure. Lots of new features are now incorporated in the 0.8.0 version, along with a modernization of PHP standards compliance carried out by @localheinz.

What's new?

The bind Generator allows to use the random output of a Generator to build another Generator.

Optionally logging generations with `hook(Listener\log($filename))`.

disableShrinking() option.

limitTo() accepts a DateInterval to stop tests at a predefined maximum time.

Configurability of randomness: choice between rand, mt_rand, and a pure PHP Mersenne Twister.

The suchThat Generator accepts PHPUnit constraints like `when()`.

Some bugs and annoyances were fixed:

No warnings on PHP 7 anymore.

Fixed bug of size not being fully explored due to slow growth.

Switched to PSR-2 coding standards and PSR-4 autoloading.

And there were some backward compatibility breaks (we are in 0.x after all):

The frequency generator only accepts variadics args, not an array anymore.

Removed strictlyPos and strictlyNeg Generators as duplicated of pos and neg ones.

Removed andAlso, theCondition, andTheCondition, implies, imply aliases which expand the surface area of the API for no good reason. Added and for multiple preconditions.

Eris is now quite extensible with custom Generators for new types of data; custom Listeners to know what's going on; and even different sources of randomness to tune repeatability and performance.
I believe what's very important about this release is the release of technical documentation. This is not a list of APIs generated by parsing the code, but is a full manual of Eris features, which will be kept up-to-date religiously in the repository itself and rebuilt automatically at each commit.

What's next?

My Trello board says:

decoupling from PHPUnit: it should be possible to run Eris also with PHPSpec (already possible but not as robustly as it can be) or in scripts.

Multiple possibilities for shrinking, borrowing from test.check rose trees. This feature may speed up the shrinking process and make it totally deterministic.

A few more advanced Generators: for example testing Finite State Machines.