Run unit tests
- Topics:
- Configuration
CREATED FOR:
- Experienced
- Admin
- Developer
This command runs a set of tests defined in the Commerce 2 code base. You can either run all tests or tests you select. Whenever an unsupported type is specified, the program terminates and lists all available types. Following execution, a detailed report displays showing the test run and results.
Prerequisites
Before you run this command, the following must be true:
-
The
Magento_Developer
module must be enabled. You can enable it as follows:bin/magento module:enable [--force] Magento_Developer
Use the
--force
option only if it is necessary. -
Your system must be set up to run the desired tests.
For example, to run integration tests, you should copy dev/tests/integration/etc/install-config-mysql.php.dist
to dev/tests/integration/etc/install-config-mysql.php
and modify it to suit your environment.
Running tests
Command usage:
bin/magento dev:tests:run <test>
To list the available test types:
bin/magento dev:tests:run --help
Sample return:
all, unit, integration, integration-all, static, static-all, integrity, legacy, default
For example, to run integration tests:
bin/magento dev:tests:run integration
Commerce
- Overview
- General setup
- Deployment
- Cache
- Command Line
- Command-line tool
- Common commands
- Enable logging
- Manage the cache
- Manage indexers
- Configure cron jobs
- Compile code
- Operation mode
- Start message queue consumers
- URN highlighter
- Dependency reports
- Localization
- Configuration management
- Static view
- Create symlinks
- Run unit tests
- Convert layout files
- Generate data for performance testing
- Run support utilities (Commerce only)
- Configuration files
- Configuration paths
- Cron Jobs
- Logs
- Message Queues
- Multiple sites
- Search Engine
- Security
- Storage
- Return to Operational Guides