[Record] xunit for vs2012/vs2013

Source: Internet
Author: User

For more information about nuint and unit test, see [unit test] nuint usage and Visual Studio configuration.

Xunit is an evolutionary version of nuint. It is used in a similar way as nuint. First download and install "xunit.net runner for Visual Studio 2012 and 2013", and run the following command to add the reference package: Install-package xunit.

Test sample code:

 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using Xunit; 6  7 namespace DemoTests 8 { 9     public class Test10     {11         [Fact]12         public void TestMethod()13         {14             Assert.Equal("1", "1");15         }16     }17 }

Xunit is easy to use. Unlike nuint, you only need to add the testfixture mark before the test class, but you only need to add the fact mark before the test method. Other usage methods (such as assertions) it is similar to nuint.

To use xunit in vs2012/vs2013, you only need to install the "nunit Test Adapter". The usage is similar to that of nuint. "nunit Test Adapter" currently supports the following test frameworks:

  • Nunit
  • Xunit.net
  • Mbunit
  • Qunit
  • Jasmine

The installation and use of the "nunit Test Adapter" can be referred to: http://www.cnblogs.com/xishuai/p/3728576.html#xishuai_h4_3

After a solution is generated, the test cases contained in the solution are automatically detected:

Record it here.

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.