2

作为软件开发人员,我是初学者。我看到很多技术博客都在讨论测试驱动开发方法。对于小型项目,还有一个关于 TDD 的 SO Post。

但我想知道,人们如何在 iOS 项目中为他们的代码编写测试类?尤其是那些截止日期很短的,你必须每周提供一个带有新功能的构建。

并且有些场景 UI 和需求会不断变化。那么我们是否只为模型中的每个功能编写测试类?

或者我们还测试我们用来为我们创建的控件编写自定义代码的逻辑,或者也用于测试视图控制器中的代码?

我想编写测试类,但我害怕在现场项目中尝试它,认为这会花费我很多时间。那么是我们测试所有功能还是测试选定的重要功能?

4

1 回答 1

4

For an experienced TDD'er it will be the fastest to write tests for everything. For someone just starting to learn TDD, using TDD might be something like 50% slower* and they might not yet know how to write tests for some hard parts (such as the UI). An advantage of using TDD in a project with tight schedules is that you can release the project whenever you wish, even after every commit, because the program should be working at all times.

* Though in my case the speed of development in my first TDD project, which took about a month, was the same as before using TDD (when measured in lines of code per hour - which isn't a good measure of productivity).

于 2012-10-25T14:37:56.643 回答