Integration tests test the interaction between individual components, layers, and an environment. They can be found in the dev/tests/integration
directory. Like unit tests, Magento also uses PHPUnit for integration tests. Thus, the difference between a unit and an integration test is not that much of a technical nature; rather, it's of a logical nature.
To specifically trigger integration tests only, we can execute the following command on the console:
php bin/magento dev:tests:run integration
When executed, Magento internally changes the directory to dev/tests/integration
and executes a command that is similar to the following one:
php /Users/branko/www/magento2/./vendor/phpunit/phpunit/phpunit
The integration directory has its own phpunit.xml.dist
file. Looking at its testsuite
definition, we can see that it is pointing to all the Test.php
suffixed files that are found in the dev/tests/integration/testsuite
directory.