PHPunit testing and code coverage via the command line–different notes

Test execution via the command line:

“c:\Program Files (x86)\PHP\v5.4\phpunit.bat” -v [FolderToTest/FileToTest]

Create a Code Coverage report via the command line:

“c:\Program Files (x86)\PHP\v5.4\phpunit.bat” –coverage-html [ResultsFolder] -v [FolderToTest/FileToTest]

Naming of unit tests:

When you want to execute tests on a folder PHPUnit exexutes only the files inside which end on Test.php,e.g. ProjectTest.php. They are not executed if they have another name; e.g.: project.test.php.

Errors about incomplete tests:

PHPUnit in combination with Netbeans returns “Perhaps an error occurred, verify in Output window.”if there are non-implemented unit tests present. Non-implemented have a command like this: $this->markTestIncomplete(‘This test has not been implemented yet.’); Such statements are often inserted when the unit test are automatically generated.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.