单元测试和功能测试?单元测试、功能、测试

2023-09-02 10:53:51 作者:寻欢

我最近听到的功能测试在单元测试。

I have recently heard of Functional Testing over Unit Testing.

据我所知,单元测试测试每一段给定的code,从最原子形式的可能性。但对于功能测试?

I understand that Unit Testing tests each of the possibilities of a given piece of code from its most atomic form. But what about Functional Testing?

这听起来好像如果code ++工程,只是测试,但它是可靠的,单元测试?

This sounds to me like only testing if the code works, but is it as reliable as Unit Testing?

有人告诉我有两个学思想的问题。某些码会preFER单元测试,其他功能测试。

I've been told there was two school of thoughts for the matter. Certains would prefer Unit Testing, others Functional Testing.

有没有什么好的资源,链接,书籍,任何引用或大家谁可以解释和elighten关于这个问题我的道路?一个

Is there any good resources, links, books, any references or one of you all who can explain and elighten my path on the subject?

谢谢!

推荐答案

贾森的回答是正确的。不同类型的测试具有不同的目的,和可以分层以获得最佳的结果(良好设计,满足规格,降低的缺陷)。

Jason's answer is correct. Different types of tests have different purposes, and can be layered for best results (good design, meeting specifications, reduced defects).

在单元测试=驱动器设计(测试驱动开发或TDD) 在集成测试=做的所有作品共同努力 在客户验收测试=它确实满足了客户的要求 在手动测试=往往涵盖了用户界面;专门的测试人员可以查找自动化失误 负载测试=如何系统是否具有真实的数据执行 Unit testing = drives design (with Test-Driven Development, or TDD) Integration testing = do all the pieces work together Customer acceptance testing = does it meet the customer's requirements Manual testing = often covers the UI; dedicated testers can find what automation misses Load testing = how well does the system perform with realistic amounts of data

有这些类别之间存在一些重叠;单元测试可以指定的行为,例如。

There is some overlap between these categories; unit tests can specify behavior, for instance.

和有其他人;超过大多数人关心知道,看软件测试。

And there are others; for more than most people care to know, see Software Testing.

有一点人们错过的是单元测试是测试的code片孤立。好的单元测试不打的数据库,例如。这有两个好处:它使测试跑的快,所以你会更经常地运行它们,这迫使你写松散耦合类(更好的设计)

One point people missed is that unit testing is testing pieces of code in isolation. Good unit tests don't hit the database, for instance. This has two advantages: it makes the tests run fast so you'll run them more often, and it forces you to write loosely coupled classes (better design).

您请求的资源;我建议罗伊Osherove的书单元测试与.NET 的例子艺术。虽然没有一本书是完美的,这一次给很多优秀的三分球上编写好的测试。

You asked for resources; I recommend Roy Osherove's book The Art of Unit Testing with Examples in .NET. While no book is perfect, this one gives many excellent pointers on writing good tests.

编辑:而对于写作对现有的软件测试中,没有什么比迈克尔羽毛的书了旧式code工作有效地。

And for writing tests against existing software, nothing beats Michael Feathers' book Working Effectively with Legacy Code.