Categories


Archives


Recent Posts


Categories


Running a Single Test in Magento 2

astorm

Frustrated by Magento? Then you’ll love Commerce Bug, the must have debugging extension for anyone using Magento. Whether you’re just starting out or you’re a seasoned pro, Commerce Bug will save you and your team hours everyday. Grab a copy and start working with Magento instead of against it.

No Frills Magento Layout is the only Magento front end book you'll ever need. Get your copy today!

Magento’s documentation tells you to run tests with the following

php bin/magento dev:tests:run unit

This isn’t wrong, but it pretty time consuming. You’re running every test in the suite. This one liner will let you run an individual test

vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist path/to/Test/Unit/SomeTest.php

Thanks to Vinai Kopp for the reminder, and don’t forget to checkout his Mage 2 Katas series on youtube.

Copyright © Alan Storm 1975 – 2017 All Rights Reserved

Originally Posted: 27th May 2016