Table of Contents

Hx_NetTest

Runs the 'dotnet test' command against the specified test files. By default, runs 'XPlat Code Coverage' with NUnit test logger https://www.nuget.org/packages/NunitXml.TestLogger. The target internally converts the generated test coverage into XMLSummary using the 'ReportGenerator' tool, and verifies the specified thresholds of source code coverage. This target also replaces source code paths using the specified regular expressions in generated *.info, *.xml, *.json files with persistent paths, i.e. paths of source code files on the particular build agent with corresponding GitHub urls, so generated test or coverage reports become portable. Such solution is flexible to support different formats of test or coverage files and different persistent paths, like GitHub, GitLab, SVN etc.

Properties

Hx_NetTest_ArtifactsDir

A path to the artifacts directory to store results in. Default is '$Hx_Run_ArtifactsDir/NetTest'.

Hx_NetTest_Logger

Specifies a logger for test results and switches for the logger, i.e.: "trx;logfilename=TestResults.trx". Default is "nunit;LogFileName=NUnitTestResults.xml".

Hx_NetTest_Collect

Specifies a data collector, i.e.: 'XPlat Code Coverage;Format=json,lcov,cobertura'. Default is 'XPlat Code Coverage' if $Hx_NetTest_VerifyCoverage is 'true' and $Hx_NetTest_RunSettingsFile is not specified/found.

Hx_NetTest_RunSettingsFile

The *.runsettings file to use for running the tests. The $Hx_NetBuild_ArtifactsDir is discovered to find a *.runsettings file if the file is not specified.

Hx_NetTest_Filter

Filters tests using the given expression: <= != ~ !~>[ | & ].

Hx_NetTest_AdapterDir

Path to a directory to be searched for additional test adapters.

Hx_NetTest_DiagFile

Enables diagnostic mode for the test platform and writes diagnostic messages to the specified file and to files next to it.

Hx_NetTest_Verbosity

Sets the verbosity level of the command. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], diag[nostic]. Default is 'minimal'.

Hx_NetTest_SourcePathRegExpOptions

The .NET regular expression options to apply to the $Hx_NetTest_SourcePathRegExp. Default is 'Multiline'.

Hx_NetTest_VerifyCoverage

Set 'true' to verify minimal coverage, otherwise 'false'. Default is 'true'.

Hx_NetTest_MinLineCoverage

The minimum line coverage 0% - 100% to pass the target. Default is 100.

Hx_NetTest_MinBranchCoverage

The minimum branch coverage 0% - 100% to pass the target. Default is 100.

Hx_NetTest_MinMethodCoverage

The minimum method coverage 0% - 100% to pass the target. Default is 100.

Items

Hx_NetTest_TestFiles

Inputs to run tests: .dll or .exe files containing tests, test projects .proj or .sln. Default is a '$Hx_NetBuild_ArtifactsDir/.sln'.

Hx_NetTest_InlineRunSettings

Run settings to be passed as '-- ...' arguments to override those in a .runsettings file. Specify run settings as MSBuild item metadata. Use '_' instead of dots for nested parameters. Example: metadata <MSTest_CaptureTraceOutput>false</MSTest_CaptureTraceOutput> becomes a 'MSTest.CaptureTraceOutput=false' argument.

Hx_NetTest_SourcePathRegExps

.NET regular expressions to find source code paths in generated files with results and replace. Found paths are replaced with stable accessible paths, i.e. raw repository links etc. Specify stable accessible paths in the 'Replacement' metadata.