Running tests from the command line
In this recipe, we will learn how to run our unit tests from the command line, which opens the possibility for automated test reporting.
Getting ready
To go through this recipe we need a basic application skeleton to work with, which should have its own set of unit tests. Go through the entire recipe Creating fixtures and testing model methods.
How to do it...
Using your operating system console, switch to your application directory, and run:
If you are on a GNU Linux / Mac / Unix system:
../cake/console/cake testsuite app case models/article
If you are on Microsoft Windows:
..\cake\console\cake.bat testsuite app case models/article
The shell should now run the specified unit test and inform us that all unit tests succeeded, as shown in the next screenshot:
![]() |
How it works...
CakePHP's testsuite
shell allows us to execute any test case, or group of test cases, from the command line. It offers several ways to specify which unit test to execute by specifying a minimum...