Testing of a class should verify that: 1. methods and properties return expected valuesCrippledsmurf - http://stackoverflow.com/questions/62625/how-do-you-know-what-to-test-when-writing-unit-tests
2. Appropriate excepts are thrown when an invalid argument is supplied
3. Interactions between the class and other objects occur as expected when a given method is called
Should you test internals (e.g. setting of private variables)? Some say no. On the other hand:
While it is true that there is a certain brittleness where test code knows internal details - this is unit testing, which is, by nature, whitebox, not black box.http://googletesting.blogspot.com/2009/02/to-assert-or-not-to-assert.html - comment by Christian Gruber
No comments:
Post a Comment