Where to start with test driven development?

断了今生、忘了曾经 提交于 2019-12-13 04:37:07

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!