Home > Backend Development > Python Tutorial > .NET Core CLI tool documentation dotnet-test

.NET Core CLI tool documentation dotnet-test

高洛峰
Release: 2016-11-21 16:53:07
Original
1403 people have browsed it

Name

dotnet-test - Run unit tests using configured test runner

Summary

`dotnet test [--configuration]

[--output] [--build-base-path] [--framework] [--runtime]
[--no-build]
[--parentProcessId] [--port]  
[<project>]`
Copy after login

Description

dotnet test command is used to execute unit tests in a given project . Unit tests are class library projects that depend on a unit testing framework (such as NUnit or xUnit) for use with the dotnet test runner.

The test project needs to specify a test runner attribute using the "testRunner" node in project.json. This value should contain the name of the unit testing framework.

The following example project.json shows the required attributes:

{
  "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"
      ]
    }
  }
}
Copy after login

dotnet test supports two running modes:

Console: In console mode, dotnet test fully executes any command passed to it and outputs the results . 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 editors or integrated development environments (IDEs). You can find more documentation about this mode at dotnet-test protocol.

Options

[project]

Specify the path to the project to be tested. If omitted, it defaults to the current directory.

-c, --configuration [Debug|Release]

is used to generate the following configuration. The default value is Release.

-o, --output [DIR]

Find the directory where the binary is run.

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

Directory for temporary output.

-f, --framework [FRAMEWORK]

View the specified framework of the test binary.

-r, --runtime [RUNTIME_IDENTIFIER]

View the specified runtime of the test binary.

--no-build

does not build the test project before running it.

--parentProcessId

Specify the ID of the process through IDEs (Integrated Development Environments). If the parent process has been processed, the test will exit.

--port

Specify the port number through IDEs (Integrated Development Environments) to listen for connections.

Example

dotnet test

Run the test on the project in the current directory.

dotnet test /projects/test1/project.json

Run the test in the test1 project.


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template