VS2013 Unit test and Code Coverage analysis--xunit

Source: Internet
Author: User

1, Javaweb in the JMeter, Jacoco, Ant, Badboy and other ways to integrate test code coverage, C # code coverage how to test it? The VS2013 IDE itself does not have the tools to integrate the tests, and the following describes the unit tests and code coverage tests for C # code in VS2013.

2, the current vs can be integrated test tool has Xunit, Nunit,xunit is the new test tool, Xunit is already hosted on Git, but still provide download on CodePlex. The following links are available:

a,http://xunit.codeplex.com/

B,https://github.com/xunit/xunit

3, There are several ways to integrate the tools:

A,vs: tools-"extensions and updates-" online-"search xunit and download the installation,

b, download the xunit.runner.visualstudio-***** and run the test tool into the system's vs.

4, how to use Xunit?

Xunit has three kinds of tests: Unit Test, Window test, Web test, Inherit good xunit, you can create a new test project under the solution of the project under test and select the required test project.

Only the functionality of the unit test is used again.

, ClassLibrary1 is the project to be tested (the unit test appears to be valid only for the class Library project), UnitTestProject1 is the test Project project, and the code is the test class and the test method.

5, Code Coverage analysis?

Testing requires the introduction of ClassLibrary1 engineering in UnitTestProject1,

The cursor rests on the test method body, right-click to run the test item, the test method will run, right-click the test method of the test window click Code Coverage Analysis to perform coverage analysis. The schematic is as follows:

6, References:

Http://www.cnblogs.com/ShaYeBlog/p/4072100.html

Official documents:

Https://msdn.microsoft.com/en-us/library/ms182532.aspx

(Original made by the small size of the cute, allow reprint)

VS2013 Unit test and Code Coverage analysis--xunit

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.