| Newsgroups |
gmane.comp.programming.test-driven-development |
| Message-ID |
<[email protected]> |
All,
I'll 2nd what Tim said, with this addition:
Since this is a TDD forum (not a general testing forum) I'll assume you're asking how to determine what microtests to write in order to drive your code to completion.
One thing I recommend to people who are just trying out TDD for the first time is to trust your existing instincts, up to a point: You already know what code needs writing to solve one of Tim's listed scenarios? STOP YOURSELF and ask "How would I test that?" What small step can you take independent of others, and how will you test (or justify) the existence of that code branch, subclass, method, or whatever? When you pass in /this/, you should get /that/. Go ahead and figure out what code you are just itching to write, then work backwards from that point in the code, but don't write the solution code first. First figure out how you would test it.
If the answer isn't simple, then you've bitten off too much behavior. Try a smaller piece.
It may end up that a single object is responsible for a Search, but there's no restriction on your design that says it has to do all that work by itself. Can you find some bit of the overall behavior which can be built independently? nextResult.isUnique()? results.empty()? Can you then build upon that success, to create simple tests for broader behaviors?
Let me end by reassuring you: If you can write the code, you can write the test. First.
Enjoy!
Rob
Rob Myers
Principal Instructor & Coach, Agile Institute
[email protected]
Twitter: @agilecoach
http://www.agileInstitute.com/
Come learn TDD in Vegas! My promo code 14CBSCWRM61 gets you an additional $200 off Agile Development Conference West registration (you win before you've even reached the tables!) http://www.sqe.com/Registration/AgileDevWest/SelectConference.aspx?eventid=14CADPW&Type=Conf
Agile Institute’s Essential Agile Engineering Practices now satisfies the 3-day technical requirement for the Scrum Alliance's Certified Scrum Developer curriculum.