I have chosen these two as primary开发者_如何转开发 candidates. My thinking goes like this:
- MbUnit has had a nice start and enjoys a smart, dedicated team of developers.
- MSFT has many resources and can compete with MbUnit easily if they choose to do so.
Which one do you believe I should bet on?
I love MbUnit because it supports parametrized tests through attributes. So you can do something like this:
[Test]
[Row(2,1,2)]
[Row(4,3,1)]
[Row(ExpectedException(typeof(DivideByZeroException)))]
void TestIntDivision(int numerator, int denominator, int result)
{
Assert.AreEqual(result, numerator/denominator);
}
NUnit is more widespread, MbUnit has the most features, but MSTest has more manpower behind it. Check this question out: NUnit vs. MbUnit vs. MSTest vs. xUnit.net
Microsoft unit testing framework is kind of tied to Visual Studio. This is both an advantage and disadvantage. Advantage is you can run tests easily from Visual Studio out of the box, disadvantage is forget about Mono support. It's worth noting that VS2010 will support 3rd party unit test frameworks.
精彩评论