本文介绍了单元测试,NUnit的或Visual Studio?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用Visual Studio(有时ReSharper的)来运行我的单元测试。

I'm using Visual studio (sometimes resharper) to run my unit test.

我听说NUnit的,但我不知道这件事情很多事情。 ..

I heard about NUnit, but I don't know many things about it...

我应该关心它?它可以提供的东西比的Visual Studio更好?

Should I care about it ? Can it offer something better than visual studio?

我应该使用NUnit的,为什么?

Should I Use NUnit and why?

推荐答案

NUnit的拥有MS-测试

NUnit has few advantages over MS-Test


  1. 套件属性一些优势 - 可以聚集测试,并分别执行它们为大(用例如与快速和慢速测试)

  2. 可读断言方法,如:项目 Assert.AreEqual(预期,实际值) VS Assert.That(实际,Is.EqualTo(预期))

  3. NUnit的有频繁的版本更新 - MS-测试只有每VS的一个版本

  4. 很多综合选手包括ReSharper的和TestDriven.NET

  5. 预期异常消息断言 - 在NUnit的使用属性来完成,但必须在MS-测试使用的try-catch来完成

  6. [TestCase的] ! NUnit的允许参数美化版测试。

  1. Suite attribute - can aggregate tests and execute them separately (useful for large projects with fast and slow tests for example)
  2. Readable Assert method, e.g. Assert.AreEqual(expected, actual) vs Assert.That(actual, Is.EqualTo(expected))
  3. NUnit has frequent version updates - MS-Test has only one per VS version.
  4. Many integrated runners including Resharper and TestDriven.NET
  5. Expected exception message assertion - can be done using attribute in NUnit but must be done using Try-Catch in MS-Test
  6. [TestCase]! NUnit allows for parameter-ized tests.

这篇关于单元测试,NUnit的或Visual Studio?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 23:34
查看更多