简体   繁体   English

nunit单元测试的参考/指南

[英]References/guides for nunit unit testing

Can anyone sugggest good references/guides for getting started with nunit and visual studio 2008. (Apart from the Nunit documentation itself!). 任何人都可以为使用Nunit和Visual Studio 2008提出好的参考/指南。(除了Nunit文档本身!)。 I specifically want to set up a test project in vs 2008. 我特别想在vs 2008中建立一个测试项目。

There's a good book called "Pragmatic Unit Testing with NUnit" by Thompson and Hunt. 汤普森和亨特(Thompson and Hunt)有一本好书,叫做《使用NUnit进行实用单元测试》。

That's how I started and it provides a good introduction. 这就是我的开始方式,它提供了很好的介绍。

For more information on how and what to test in general I'd recomment "The Art of Unit Testing" by Osherove and "Test Driven Development" by Beck. 有关一般如何进行测试的更多信息,我推荐Osherove撰写的“单元测试的艺术”和Beck撰写的“测试驱动开发”。

Also take a look at this helpful summary card also from Thompson and Hunt 还可以看看汤普森和亨特的这张有用的摘要卡

http://media.pragprog.com/titles/utj/StandaloneSummary.pdf . http://media.pragprog.com/titles/utj/StandaloneSummary.pdf

The concepts are further explained in their book. 这些概念将在其书中进一步解释。

Update: Not sure I can recommend any books that describe the mechanics of setting up your project but I can offer some basic advice. 更新:不确定我是否可以推荐任何描述设置项目机制的书籍,但是我可以提供一些基本建议。 Create a separate test project for each source project you want to test. 为要测试的每个源项目创建一个单独的测试项目。 Make sure you don't mix integration/system testing with your unit tests. 确保不要将集成/系统测试与单元测试混在一起。 One way to ensure this is to differentiate between test projects. 确保这一点的一种方法是区分测试项目。 eg I might have something like 例如,我可能有类似的东西

  • CustomLibraryCode.proj //source project CustomLibraryCode.proj //源项目
  • CustomlibraryCodeTests.Unit.proj //unit test project CustomlibraryCodeTests.Unit.proj //单元测试项目
  • CustomLibraryCodeTests.Integration.proj //integration test project CustomLibraryCodeTests.Integration.proj //集成测试项目

This means that your unit tests which should be quick and easy to run can be executed in isolation from the integration tests, which typically might have dependencies on database, filesystem, etc., and tend to be slower and more brittle. 这意味着可以独立于集成测试来执行应该快速且易于运行的单元测试,而集成测试通常可能依赖于数据库,文件系统等,并且速度较慢且较脆弱。

除了提到的其他书籍之外,还有一本新的好书,其中包含大量示例: 不断发展的面向对象软件,由测试指导

I just got The Art of Unit Testing with Examples in .NET by Roy Osherove. 我刚获得Roy Osherove撰写的.NET中带有示例的单元测试的技巧。 You can get it at Amazon and here is the site: http://artofunittesting.com/ . 您可以在Amazon上获得它,这里是网站: http : //artofunittesting.com/ It's pretty easy to understand. 很容易理解。 The book is written with examples in VS 2008 and Nunit. 这本书是用VS 2008和Nunit中的示例编写的。 He also mentions other test frameworks. 他还提到了其他测试框架。

Dimecasts 涵盖NUnit简短视频非常不错,该页面以相反的顺序列出它们,因此请从底部开始并逐步进行!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM