Nunit 你有什么相关经验
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
http://www.amazon.com/Pragmatic-Unit-Testing-NUnit-2nd/ dp/0977616673/ref=dp_ob_title_bk
http://www.amazon.com/Pragmatic-Unit-Testing-NUnit-2nd/dp/0977616673/ref=dp_ob_title_bk
我建议您阅读以下书籍:
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!
设置 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.