dotnet-testx
1.4.1
See the version list below for details.
dotnet tool install --global dotnet-testx --version 1.4.1
dotnet new tool-manifest # if you are setting up this repo dotnet tool install --local dotnet-testx --version 1.4.1
#tool dotnet:?package=dotnet-testx&version=1.4.1
nuke :add-package dotnet-testx --version 1.4.1
# dotnet-testx
Extensions to the `dotnet test` command that enable code coverage reporting using [OpenCover](https://github.com/OpenCover/opencover) and a few other bonus features
NOTE: Due to OpenCover being Windows only, this tool will only work on Windows
## Features
1. Run `dotnet test` with code coverage tracking by OpenCover
1. Generate cobertura covberage results (useful for VSTS/TFS coverage reporting). Uses [OpenCovertToCobeturaConverter](OpenCoverToCoberturaConverter)
1. Generate an HTML coverage report using [ReportGenerator](ReportGenerator)
1. Discover all test projects in a folder and run tests for all of them (not natively supported by `dotnet test`)
_The coverage and reporting tools are not bundles into this tool. They need to be installed as dependencies on the project that you're running this on._
Currently assumes the dependencies are located in `%userprofile%/.nuget/packages/opencover/<versionspec>/tools/OpenCover.Console.exe`
`%userprofile%/.nuget/packages/reportgenerator/<versionspec>/tools/ReportGenerator.exe`
`%userprofile%/.nuget/packages/opencovertocobeturaconverter/<versionspec>/tools/OpenCoverToCoberturaConverter.exe`
## Installation
The tool is installed as a global dotnet tool (.net Core 2.1+)
`dotnet tool install -g dotnet-testx`
## Usage
`dotnet testx --help`
```text
--discover-projects Discover all files in the working directory
matching the pattern and run tests on them. Alias
for '--project all'
--project Project to test. If you specify 'all' then it
will find all projects in the folder and
subfolders matching '*Tests.csproj'
--opencover-version Optional OpenCover version.
--html (Default: false) Generate an HTML report
--browser (Default: false) If generating an HTML report,
open in the default browser
--cobertura (Default: false) Generate a cobertura report
--test-results-format (Default: trx) The format to use for the VSTest
test results
--opencover-filters (Default: +[*]*) Filters for opencover, i.e.
files to include/exclude from report
--opencover-mergeresults (Default: true) Merge multiple runs into the same
results file
--verbose (Default: false) Log more verbose details of
whats happening
--help Display this help screen.
--version Display version information.
```
## Tip
In .net core 2.1 onwards, you can run this as part of dotnet watch
`dotnet watch` requires it own project argument so it knows which files to watch
Use -- to separate `dotnet watch` arguments from `dotnet testx` arguments
`dotnet watch --project [project-file] testx -- [dotnet testx arguments]`
This will re-run your tests and update the coverage reports on each file change. You can then keep a browser window open and just refresh the coverage report to ensure your changes are improving coverage.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
.NET Core | netcoreapp2.1 is compatible. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
-
.NETCoreApp 2.1
- No dependencies.
Initial release