问题
I'm relatively new to Test Driven Development, and I was just wondering where I should start? I understand how to do the testing. I just mean what should I test first? Is there a best practice for this? Should I test the models first? The controllers? Should I write an integration test first thing, then build everything up from there to make it pass?
What are the opinions on this?
回答1:
I don't think there's one hard and fast answer on where to start.
I personally like to start with my UI first because I want to understand the full user experience before I worry about what happens behind the scenes. However, I know developers who want to start with their models first and build the UI to match them.
So to answer your question, start where ever you feel most comfortable, build your tests then build whatever you need to make them pass.
回答2:
A book on Test Driven Development by Kent Beck would be a good start. It explains everything you need to know to get started with TDD.
来源:https://stackoverflow.com/questions/18747251/where-to-start-with-test-driven-development