LinuxCommandLibrary

atoum

Schedule commands to run later

TLDR

Initialize a configuration file

$ atoum --init
copy

Run all tests
$ atoum
copy

Run tests using the specified configuration file
$ atoum [[-c|--configuration]] [path/to/file]
copy

Run a specific test file
$ atoum [[-f|--files]] [path/to/file]
copy

Run a specific directory of tests
$ atoum [[-d|--directories]] [path/to/directory]
copy

Run all tests under a specific namespace
$ atoum [[-ns|--namespaces]] [namespace]
copy

Run all tests with a specific tag
$ atoum [[-t|--tags]] [tag]
copy

Load a custom bootstrap file before running tests
$ atoum [[-bf|--bootstrap-file]] [path/to/file]
copy

SYNOPSIS

atoum [options...] [[directory|file]...]

PARAMETERS

-h, --help
    Display help message

-V, --version
    Show atoum version

--test-ext ext
    Test file extension (default: .php)

-b, --bootstrap file
    PHP bootstrap file path

--php path
    PHP binary to execute

-d, --dir dir
    Add test directory

-x, --exclude path
    Exclude directory or file

-sf, --stop-on-failure
    Halt on first failure

--coverage [format]
    Generate coverage report

-r, --report reporter
    Output format (dot, tap, etc.)

-c, --config file
    Configuration file

-p, --php-path path
    PHP path for tests

--min-coverage percent
    Minimum coverage threshold

-l, --loop count
    Loop tests N times

DESCRIPTION

Atoum is a simple, modern, and intuitive unit testing framework for PHP, emphasizing developer productivity and readable test code. The atoum command-line tool executes unit tests from specified files or directories, supporting fluent assertions, automatic mock generation, and loop testing for edge cases.

Key strengths include minimal boilerplate, natural PHP syntax without XML configs, and fast execution. It generates various reports (dot, TAP, xUnit, Clover) and integrates code coverage via Xdebug. Tests use a chainable API: $this->given($generator)->if($object->method()) for readable scenarios.

Ideal for TDD/BDD in PHP projects, atoum avoids PHPUnit's verbosity. It's standalone via PHAR, Composer-installable, and supports PHP 7.2+. Widely used in open-source and enterprise for its speed and simplicity, with CI/CD compatibility.

CAVEATS

Requires PHP 7.2+ and optional Xdebug for coverage. Not a standard Linux package; install via Composer (composer global require atoum/atoum) or PHAR. Tests must follow atoum conventions.

INSTALLATION

PHAR: curl -Lk https://github.com/atoum/atoum/releases/latest/download/atoum.phar -o atoum.phar
chmod a+x atoum.phar
Composer: composer require --dev atoum/atoum

BASIC EXAMPLE

atoum tests/ runs tests in tests/.
atoum.phar --bootstrap bootstrap.php --coverage=clover src/ for coverage.

ASSERTIONS

Uses fluent chains: $this->integer(42)->isEqualTo(42)
$this->mock(Class::class)->call('method')->returns('value')

HISTORY

Created by Frédéric Hardy in 2011 as a simpler PHPUnit alternative. First stable release 2012; evolved with PHP versions up to 8.3. Actively maintained on GitHub with 2k+ stars.

SEE ALSO

phpunit(1), php(1), vendor/bin/phpunit(1)

Copied to clipboard