问题描述
限时送ChatGPT账号..我的导师最近向我介绍了测试驱动的开发方法,他鼓励我在有意义"的时候编写单元测试.我理解为回归测试和折射测试提供完整的单元测试套件的一些好处,但我确实想知道我们应该多久编写一次单元测试以及如何编写单元测试.
I am recently introduced to the test-driven approach to development by my mentor at work, and he encourages me to write an unit-test whenenver "it makes sense." I understand some benefits of having a throughout unit-test suite for both regression testing and refractoring, but I do wonder how often and how throughout we should write unit-test.
我的导师/开发负责人要求我为现有测试类已经在测试的方法中新编写的控制流编写一个新的单元测试用例,我认为这是一种矫枉过正.你多久编写一次单元测试,你认为你的单元测试应该有多详细?谢谢!
My mentor/development lead asks me to write a new unit test-case for a newly written control flow in a method that is already being tested by the exsisting test class, and I think it is an overkill. How often do you write your unit tests, and how detailed do you think your unit tests should be? Thanks!
推荐答案
从技术上讲,如果您遵循严格的测试驱动开发...您应该在对应用程序的任何部分进行规范之后编写单元测试.你应该从:
Technically, if you're following strict Test Driven Development...you should be writing your Unit Tests after you have spec'd any portion of your application. You should be going from:
用户需求 -> 功能设计 -> 单元测试 -> 代码
User Requirements -> Function Design -> Unit Tests -> Code
请记住,在 TDD 中,测试先于代码.
这篇关于我们应该多久编写一次单元测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论