What's wrong with zentest, specifically?
You will probably understand better by watching the movie, but zentest encourages you to make a test case for each class and a test method for each method.
Which will match up 1:1 if you factor your code well.
BDD teaches that these decisions are pretty arbitrary.
I don't use BDD because I already have my tests broken up by units of behavior. I call them methods.
BDD presents a method of thinking about test design to help you focus on better object design and object modeling. Unit testing doesn't have this method of thinking built-in, you have to discover it. (Although it makes itself evident if you pay attention to how difficult it is to test something.)
The true goal of testing is to test the "behaviors" of your object. If that means interacting with five methods or just one possible call sequence of a method that has several, that's what you should really be testing.
I think there are two true goals of testing. One is to enumerate your edge cases so each one behaves as you expect. Another is to get feedback about how well you've designed your program. Both are equally important.
If you want to write specifications to enumerate your edge cases, great. However, if you've factored poorly neither BDD nor TDD will give you small, concise tests nor a small, concise implementation.
What do if you need to work with two classes at one to test something?
Then your classes are probably coupled too tightly.
This class and method organization is also encourages you to use so-so names for your tests at best. If you have a Calendar class and a TestCalendar, that's pretty much saying the same thing twice (a violation of DRY) and it doesn't tell you much. BDD encourages you to actually express what you are testing with your naming. This really helps you focus on the goal of the process and is much less arbitrary.
Mapping tests to classes 1:1 is a sign of proper design. Your implementation's names should reflect the behavior implemented within. If you have to give different names to your tests and your implementation you've probably named your implementation poorly. Instead you should refactor your implementation so that it can be named well.
Read the tutorial on the rspec site:
http://rspec.rubyforge.org/tutorials/index.html
The specifications match up with the implementation very well, so the Stack is probably well-designed. If they didn't, that's a good sign of code smell.
(You get the same code smell out of unit testing, it just smells a little different.)
···
On Jan 23, 2007, at 16:26, James Edward Gray II wrote:
On Jan 23, 2007, at 6:10 PM, Joe Van Dyk wrote:
--
Eric Hodel - drbrain@segment7.net - http://blog.segment7.net
I LIT YOUR GEM ON FIRE!