Command Line Interface
This document describes the command line interface for Testo.
Binary Path
If Testo is installed via Composer, the binary path will be vendor/bin/testo. The examples below use just testo for brevity, but in real projects use vendor/bin/testo or set up an alias in your environment.
Commands
testo run
Execute test suites with optional filtering and output formatting.
This is the default command and can be omitted when using flags.
testo run [options]
testo [options] # run is optionalExamples:
# Explicit run command
testo run
testo run --suite=Unit
# Implicit run command (default)
testo
testo --suite=UnitCommon Configuration Flags
--config
Specify path to configuration file.
Default: ./testo.php
Examples:
testo run --config=./custom-testo.php
testo run --suite=Integration --config=./ci-testo.phpRunning Tests
Output Formatting
--teamcity
Enable TeamCity service message format for JetBrains IDE integration.
Used by the Testo plugin for PHPStorm/IntelliJ IDEA and TeamCity CI server.
Examples:
testo --teamcity
testo --suite=Unit --teamcityFiltering
Testo provides three types of filters that can be combined to selectively run tests.
Filter Combination Logic:
- Same type filters use OR logic:
--filter=test1 --filter=test2→ test1 OR test2 - Different type filters use AND logic:
--filter=test1 --suite=Unit→ test1 AND Unit - Formula:
AND(OR(filters), OR(paths), OR(suites))
For detailed information about filtering behavior, see Filtering.
--suite
Filter tests by test suite name. Suites are defined in configuration.
Repeatable: Yes (OR logic)
Examples:
# Single suite
testo run --suite=Unit
# Multiple suites
testo run --suite=Unit --suite=Integration--path
Filter test files by glob patterns. Supports wildcards: *, ?, [abc]
Repeatable: Yes (OR logic)
Note: Asterisk * is automatically appended if the path doesn't end with a wildcard.
tests/Unitbecomestests/Unit*tests/Unit/becomestests/Unit/*
Examples:
# Matches tests/Unit*
testo run --path="tests/Unit"
# Matches tests/Unit/*Test.php
testo run --path="tests/Unit/*Test.php"
# Multiple paths
testo run --path="tests/Unit" --path="tests/Integration"
# Nested directories
testo run --path="tests/*/Security/*Test.php"--filter
Filter tests by class, method, or function names.
Repeatable: Yes (OR logic)
Supported Formats:
- Method:
ClassName::methodNameorNamespace\ClassName::methodName - FQN:
Namespace\ClassNameorNamespace\functionName - Fragment:
methodName,functionName, orShortClassName
Examples:
# Specific method
testo run --filter=UserTest::testLogin
# Entire class
testo run --filter=UserTest
# By FQN
testo run --filter=Tests\Unit\UserTest
# Method name across all classes
testo run --filter=testLogin
# Multiple filters (OR)
testo run --filter=UserTest::testCreate --filter=UserTest::testUpdate
# Combine with other filters (AND)
testo run --filter=testAuthentication --suite=Unit
testo run --filter=UserTest --path="tests/Unit"Filter Behavior: See Filtering for details.
Combining Filters
Examples:
# Name AND suite
testo run --filter=testLogin --suite=Unit
# Name AND path
testo run --filter=UserTest --path="tests/Unit"
# All three types (AND)
testo run --filter=testImportant --path="tests/Unit" --suite=Critical
# Multiple values with multiple types
testo run \
--filter=testCreate --filter=testUpdate \
--path="tests/Unit" --path="tests/Integration" \
--suite=CriticalExit Codes
0(SUCCESS): All tests passed1(FAILURE): One or more tests failed2(INVALID): Invalid command or configuration