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.