从哪里开始测试驱动开发? [英] Where to start with test driven development?

查看:63
本文介绍了从哪里开始测试驱动开发?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对测试驱动开发比较陌生,我只是想知道我应该从哪里开始?我了解如何进行测试.我只是说我应该先测试什么?是否有最佳实践?我应该先测试模型吗?控制器?我应该首先编写集成测试,然后从那里构建所有内容以使其通过吗?

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?

对此有何看法?

推荐答案

我认为从哪里开始没有一个硬性的答案.

I don't think there's one hard and fast answer on where to start.

我个人喜欢先从我的 UI 开始,因为我想在担心幕后发生的事情之前了解完整的用户体验.但是,我知道开发人员想要先从他们的模型开始,然后构建与之匹配的 UI.

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.

这篇关于从哪里开始测试驱动开发?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆