Visual Studio unit test vs nunit

Source: Internet
Author: User

In the companyNunitBut it is not easy to use because vs testing is found.CodeAutomatically generated. So we roughly comparedVisual StudioBuilt-inUnit TestAndNunit.

InStackoverflowSomeone has discussed this issue. The following entries are extracted from each webpage. Make a summary for your reference. 

 

On the surface, different class libraries are used. This problem is well solved by a macro.

 

# If! Nunit

Using Microsoft. visualstudio. testtools. unittesting;

# Else

Using nunit. Framework;

Using testclass = nunit. Framework. testfixtureattribute;

Using testmethod = nunit. Framework. testattribute;

Using testinitialize = nunit. Framework. setupattribute;

Using testcleanup = nunit. Framework. teardownattribute;

Using testcontext = system. String;

Using deploymentitem = nunit. Framework. descriptionattribute;

# Endif

 

 

NunitThere are several advantages

1.Independent fromIDE, Which can be run independently. You can also run the command line. (VSShould it be OK ?)

2.Quick version updates. (I don't think this is an advantage, and I don't think it's quick .)

3.VSOfUTThe tool runs slowly. (Not necessarily)

 

NuiteThere are also several shortcomings

1.Not SupportedDebugTo installTestdriven. net.

2.You cannot view code coverage.Ncover. WhileVSCode coverage is very clear.

3.The test code cannot be automatically generated.CodesmithIt is better to use it together, but it will be charged later.

 

Note: The XML generated by ncover is too large, and crash is triggered when IE is not moved (ncoverexplorer is better, but the company does not ......). After searching for half a day today, I have not found any command line parameter for ncover to generate only data of a specific namespace. Finally, I changed the XSL to not display the method-level XML, which is better.

 

 

Vs UTBiggest drawback-price! OnlyVs proOnly supportedUT, OnlyVstsCode coverage is supported.

 

Some people think thatVsutRelatively difficultCc. netIntegration. Although I did not tryCCDirectly useVsutBut it should be okay.

 

Let's take a look.VS.

 

 

With premium msdn

With professional msdn

Without msdn

Vs 2008 team system

$10939

 

 

Vs 2008 professional

$2499

$1199

$799

V. S. 2008 Standard

 

 

$299

 

For the latest quotation, refer:Http://msdn.microsoft.com/en-us/aa700832.aspx

In addition, resharper(30Day Trial ),Xunit(Open Source ),MbunitBothUTA good choice.

 

Refer:Http://stackoverflow.com/questions/92869/nunit-vs-visual-studio-2008s-test-projects-for-unit-testing

Http://stackoverflow.com/questions/709/net-testing-framework-advice

Http://stackoverflow.com/questions/1760/net-unit-testing-packages

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.