Quantcast
Channel: Webkul Blog
Viewing all articles
Browse latest Browse all 5490

Running Unit Tests in Magento2 using CLI command

$
0
0

Running all unit tests

  • Navigate to your Magento root directory.
  • Run the below command, where c option specifies the path to the phpunit configuration file
./vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist

Running only a subset of the unit tests

  • For running unit tests only for a single module use the below command.
./vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist app/code/Example/Module/Test/Unit
  • You need to specify your module directory as shown in the above code snippet.
  • After that, the phpunit will scan the directory for files ending with Test.php and try to execute them.


Viewing all articles
Browse latest Browse all 5490

Trending Articles