Unit Tests (Design tests) or not...
When do you use unit tests - tests that test your design vs. tests that test the functionality of the app.
Unit test have good and bad aspects to them. The good stuff:
1) They encourage you to understand what your building at a microscopic level
2) They help with defect triangulation - a particular test should fail when a piece inside the system fails.
3) They encourage better design
4) They can cause you to write fewer functional tests - I find this is especially true around error handling, not sure about "calculation" business logic.
They have bad aspects:
1) They cause your design to be more rigid. Its harder to throw away design when it has a bunch of unit tests, because you must bring all the tests up to date as well. Some may be relevant and some may not.
2) They are far more fragile - I find myself maintaining them far more than the acceptance tests, often for things that are not interesting (renaming a variable/Constant).
In summary, we are experimenting with implementing them AFTER the design has solidified.
1) Get your functional test working - brute force (no unit tests, simplest thing possible)
2) Get some moretests working - brute force (no unit tests, simplest thing possible)
3) REDESIGN and Unit test once the design has become clear from the former examples.
4) Unit test when things get interesting
0 Comments:
Post a Comment
<< Home