XUnit. Net Usage memorandum (1): installation and use test, xunit.net Memorandum

Source: Internet
Author: User
Tags xunit

XUnit. Net Usage memorandum (1): installation and use test, xunit.net Memorandum

Directory

    • Preparations
    • Environment Installation
    • Use test
    • Other Instructions
I. Preparations

Tools are indispensable. The tool is ready:
1.Visual Studio2015
2.ReSharper9.1.1 +
3.NestIn

II. Environment Installation

Create a class library project for testing:

Use NuGet Package Manager to reference xUnit. Net-related Assembly

 

 

You can also use the command line in the NuGet console for quick installation.

PM> Install-Package xunit

PM> Install-Package xunit. runner. visualstudio

If you want to use ReSharper to call test cases like me, you only need to install the first xunit. If you want to use the test resource manager that comes with VS for calling, you also need to install xunit. runner. visual studio. To use ReSharper for debugging, you also need to install an extension as shown in. If your ReSharper version is 10 or later, you do not need to install this extension. It comes with support.

 

 

 

 

 

 

 

After the installation preparation is complete, let's test and use it as needed.

Iii. Test

 

Create a new test case class and add relevant features and assertions to the method to be tested. If ReSharper is installed, click the icon on the left to make a quick call.

IV. Other Instructions

When used, the output information in the console cannot be captured and displayed in ReSharper. After studying the documents on the official website, we found that the method was replaced by ITestOutputHelper after v1.x was released to v2.x, the WriteLine of this interface can be used to output information.

 

 

Official documentation problem link: http://xunit.github.io/docs/capturing-output.html

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.