This article will briefly introduce the following unit test tools and recommend some learning resources.
1. Nunit
2. TestDriven.NET
3. Nunitforms
4. Nunitasp
A Nunit
Mention the famous NUnit, I think few don't know? NUnit is a unit testing framework specifically for. NET. Before that, there were junit for Java, CPPUnit for C + +, all of which belonged to the Xunit family. NUnit is the 4th main product of the Xunit family, written entirely by the C # language, and is fully utilized in writing. NET's characteristics, such as reflection, customer attributes, and so on, the most important thing is that it is suitable for all. NET language.
Write a simple unit test code:
It is very simple to use and is run as follows:
[TestFixture]public class TestDatabase{
[Test]
public void TestWithDebugger()
{
ClassA ca = new ClassA();
int expected = 3 int result = ca.GetResult();
Assert.AreEqual(expected,result);
}}
NUnit is very simple to use, won a number of users, and even Microsoft in the corporate library of the source code also provides the use of NUnit test version, but NUnit my most uncomfortable place is not providing Visual Studio IDE plug-ins, so if you do unit testing, You'll find yourself running around the IDE and NUnit GUI all the time, constantly switching windows; And while NUnit is a brother with JUnit, its prestige and ability is far worse than JUnit's, especially scalability, and I'll introduce a NUnit WinForm plugin later.
Learning Resources
Official documents of the NUnit
Personally, the difficulty with NUnit is the writing of test cases, rather than the use of the tools themselves.
Official homepage: http://www.nunit.org/
Two TestDriven.NET
TestDriven.NET listed in the Open source project introduction In fact, some of the inappropriate, because it is now a commercial tool, only the personal version can be downloaded free of charge, personally think in the development of the personal version of the function is enough, the reason I want to put it here to introduce, because it is too good. The NUnit mentioned earlier, although very simple to use, but it can not be with us. NET development environment, and TestDriven.NET is one of the unit test tools integrated in Visual Studio in the form of Plug-ins, formerly known as Nunitaddin, developed by Jamie Cansdale Master, At first the author just wanted to do a NUnit plug-in is integrated into Visual Studio, and after several versions of the update, Nunitaddin changed its name to TestDriven.NET at the end of September 2004 and released its first release version at the beginning of December. That is, TestDriven.NET 1.0. At the end of October this year, the release of TestDriven.NET 2.0 was finally ushered in, with the latest version 2.0 integrating. NET Reflector, Nconver, Nconverexplorer, Typemock.net and so on, the function is more powerful, we still use the previous example:
[TestFixture]public class TestDatabase{
[Test]
public void TestWithDebugger()
{
ClassA ca = new ClassA();
int expected = 3 int result = ca.GetResult();
Assert.AreEqual(expected,result);
}}
All of its operations are done through the right key menu in the IDE.
The integration with the IDE allows us to quickly navigate to the line of code that went wrong.
Because the use of testdriven.net is very simple, so at present basically no Chinese article introduction, you can refer to the official website on the QuickStart.