Unit tests are designed to test individual class methods in isolation, asserting all possible combinations and taking care of the smallest testable part of an application. Magento uses the PHPUnit testing framework for its unit tests. Being highly focused, unit tests make it easy to identify the root cause of issues if a certain test fails.
We can specifically trigger the unit tests from the root of the Magento installation by using the following command:
php bin/magento dev:tests:run unit
Once triggered, Magento will run the execute
command in the vendor/magento/module-developer/Console/Command/DevTestsRunCommand.php
file. Since the unit type is mapped to several commands, what will happen internally is that Magento will change the directories from one directory to another, as follows:
dev/tests/unit
dev/tests/performance/framework/tests/unit
dev/tests/static/framework/tests/unit
dev/tests/integration/framework/tests/unit
We can say that all of these directories are considered unit...