. NET Core CLI Tools Documentation dotnet-test

Source: Internet
Author: User

Name

Dotnet-test-run unit tests using the configured test runner

Profile

' Dotnet test [--configuration]

[--output] [--build-base-path] [--framework] [--runtime] [--no-build] [--parentprocessid] [--port]  [<project>] '

Describe

The dotnet Test command is used to perform unit tests on a given project. A unit test is a class library project that relies on a unit test framework (for example: NUnit or XUnit), and the unit test framework is used for dotnet test runner.

The test project needs to specify a Test runner property in Project.json using the "Testrunner" node. This value should contain the name of the unit test framework.

The following example Project.json shows the required properties:

{"  version": "1.0.0-*",  "Buildoptions": {    "debugtype": "Portable"  },  "dependencies": {    " System.Runtime.Serialization.Primitives ":" 4.1.1 ",    " Xunit ":" 2.1.0 ",    " Dotnet-test-xunit ":" 1.0.0- Rc2-192208-24 "  },  " Testrunner ":" Xunit ",  " frameworks ": {    " netcoreapp1.0 ": {      " dependencies " : {"        Microsoft.NETCore.App": {"          type": "Platform",          "version": "1.0.0"        }      },      "Imports" : [        "dotnet5.4",        "Portable-net451+win8"      ]    }  }

The dotnet test supports two modes of operation:

Console: In console mode, dotnet test completely executes any command that is passed to it and outputs the result. Any time you call dotnet test without passing--port, it runs in console mode, which in turn will cause the runner to run in console mode.

Design phase: Used in the context of other tools, such as an editor or an integrated development environment (IDES). You can find more documents about this mode in Dotnet-test protocol.

Options

[Project]

Specifies the path to test the project. If omitted, the current directory is assumed to be default.

-C,--configuration [debug| Release]

Used for the configuration under build. The default value is Release.

-O,--output [DIR]

Locate the binary run directory.

-B,--build-base-path [DIR]

The temporary output directory.

-F,--framework [Framework]

View the specified framework for the test binaries.

-R,--runtime [Runtime_identifier]

View the specified runtime of the test binaries.

--no-build

The test project that runs it before it is built.

--parentprocessid

Specifies the ID of the process through IDES (integrated development environment). If the parent process has already been processed, the test exits.

--port

Listen for connections by specifying port numbers IDEs (integrated development environment).

Example

dotnet Test

Run the test on the project in the current directory.

Dotnet Test/projects/test1/project.json

Run the tests in the Test1 project.

  • 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.