Nunit 你有什么相关经验

发布于 2024-10-03 13:14:38 字数 71 浏览 2 评论 0原文

NUnit 如何帮助您提出单元测试解决方案?您从头开始实施它的速度有多快?有什么技巧可以帮助我们快速有效地实施 Nunit 吗?

How NUnit has helped you to come out with your solution for unit tests? How fast you were able to implement it from the scratch? Any tips can be given which will help us to implement Nunit quickly and efficiently?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

贱贱哒 2024-10-10 13:14:52

我建议您阅读以下书籍:
http://www.manning.com/osherove/
肯定会加快你的学习曲线。如果您有足够的经验,您可以在前三章(一个周末)后开始。祝你好运!

I recommend you read the following book:
http://www.manning.com/osherove/
Will definitely speed up your learning curve. If you have sufficient experience you can get started after the first three chapters (one weekend). Best of luck!

无言温柔 2024-10-10 13:14:49

设置 NUnit 测试项目只需要几分钟的时间:添加新的类库项目,添加 NUnit 框架引用,然后就完成了。

您的代码进行单元测试的难易程度取决于与任何其他代码隔离的难易程度。

没有依赖性的方法将是最容易测试的 - 但不太可能特别有用。大多数情况下,您会调用其他类来做某事。

在类构造函数中具有特定的所有依赖项的方法将很容易测试 - 只要您可以隔离依赖项并将其传递进去。

直接调用其他类的方法将更难以测试,并且可能不会可以根据其交织的深度进行严格的单元测试。

查找并了解测试类型之间的差异。

Setting up an NUnit Test project is the work of a few moments: Add new Class Library project, add NUnit Framework reference, and you're done.

How easily your code is unit testable depends on how easy it is to isolate from any other code.

A method which has no dependencies, is going to be the easiest to test - but least likely to be particularly useful. Most often, you're calling some other class to do something.

A method which has all it's dependencies specific in the class constructor will be straightforward to test - so long as you can Isolate the dependencies and pass those in.

A method which directly calls other classes is going to be more difficult to test, and may not be possible to do a strict unit test depending on how deeply intertwined it is.

Look up and understand the difference between the types of Testing.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文