Showing posts with label unit testing. Show all posts
Showing posts with label unit testing. Show all posts

Sunday, June 12, 2011

Creating a Skeleton Test Quickly Using PHPUNIT

To quickly write a skeleton unit test for php application classes, do the following.

# phpunit --skeleton-test <classname> <relative or absolute path of the file>

This gives you,

  1. Placeholder tests for all public methods of the target class
  2. Marks these tests as incomplete for easy tracking
  3. Gives a tear down and setup methods for you to initialize and destroy  test fixtures
  4. Basic construction of the object
Lots of lines of test code by typing one-liner shell command. That's what you call productivity!


Saturday, May 22, 2010

Common Use Cases to Generate User-Input Test Cases

The most common and underused tool available for gaining good test coverage on your product or application regardless if it's automated or manually done is a checklist. A checklist dictates what process or steps to take when encountering a particular use case similar to how an expert would know what to do given that he had substantial experience over the matter. Thus, it can also be used as an effective way of rapidly transferring knowledge over to other individuals later on. It can also help you prevent from forgetting obvious tests when you are engaged with a very complex test suite.