<?xml version="1.0" encoding="UTF-8"?>


<dsl-extension kind="buildStep" type="dotnet" generateDslJar="true" applicable="params['command'] == 'test'">
    <class name="DotnetTestStep">
        <description>
            A [dotnet test step](https://github.com/JetBrains/teamcity-dotnet-plugin) to run .NET CLI command
        </description>
    </class>
    <function name="dotnetTest">
        <description>
            Adds a [dotnet test step](https://github.com/JetBrains/teamcity-dotnet-plugin) to run .NET CLI command
            @see DotnetTestStep
        </description>
    </function>
    <init>
        <param name="command" value="test"/>
    </init>
    <params>
        <param name="paths" dslName="projects">
            <description>Specify paths to projects and solutions. Wildcards are supported.</description>
        </param>
        <param name="excludedPaths" dslName="excludedProjects">
            <description>Specify paths to excluded projects. Wildcards are supported.</description>
        </param>
        <param name="teamcity.build.workingDir" dslName="workingDir" yamlName="working-directory">
            <description>
                [Build working directory](https://www.jetbrains.com/help/teamcity/?Build+Working+Directory) for
                script,
                specify it if it is different from the [checkout
                directory](https://www.jetbrains.com/help/teamcity/?Build+Checkout+Directory).
            </description>
        </param>
        <param name="test.testCaseFilter" dslName="filter">
            <description>Specify the test case filter.</description>
        </param>
        <param name="framework">
            <description>Target framework to test for.</description>
        </param>
        <param name="configuration">
            <description>Target configuration to test for.</description>
        </param>
        <param name="outputDir" yamlName="output-directory">
            <description>The directory where to find the binaries to be run.</description>
        </param>
        <param name="skipBuild" type="boolean" trueValue="true" falseValue="">
            <description>Do not build the project before testing</description>
        </param>
        <param name="singleSession" dslName="singleSession" type="boolean" trueValue="true" falseValue="">
            <description>
                Whether TeamCity should run tests in a single session
            </description>
        </param>
        <param name="test.settingsFile" dslName="settingsFile">
            <description>Run tests that match the given expression.</description>
        </param>
        <param name="test.retry.maxRetries" dslName="maxRetries">
            <description>Rerun failed tests until they pass or until the maximum number of attempts is reached.</description>
        </param>
        <param name="args">
            <description>Enter additional command line parameters for dotnet test.</description>
        </param>
        <param name="verbosity" dslName="logging" type="Verbosity">
            <description>
                Specify logging verbosity
                @see Verbosity
            </description>
        </param>
        <param name="required.sdk" dslName="sdk">
            <description>.NET SDK versions separated by semicolon to be required on agents.</description>
        </param>
    </params>
    <types>
        <enum name="Verbosity">
            <description>
                Logging verbosity
            </description>
            <option name="Quiet" value="Quiet"/>
            <option name="Minimal" value="Minimal"/>
            <option name="Normal" value="Normal"/>
            <option name="Detailed" value="Detailed"/>
            <option name="Diagnostic" value="Diagnostic"/>
        </enum>
    </types>
    <examples>
        <example>
            <description>
                Runs [`dotnet test`](https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-test) command for all the solution files in the checkout directory.
                Does not try to build the project, assumes this is already done by some previous step.
            </description>
            <code>
                dotnetTest {
                    projects = "*.sln"
                    skipBuild = true
                }
            </code>
        </example>
        <example>
            <description>
                Runs [`dotnet test`](https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-test) for the MyProject.sln solution file.
                Collects code coverage with help of [JetBrains DotCover](https://www.jetbrains.com/dotcover/) for the specified assemblies.
            </description>
            <code>
                dotnetTest {
                    projects = "MyProject.sln"
                    skipBuild = true
                    coverage = dotcover {
                        toolPath = "%teamcity.tool.JetBrains.dotCover.CommandLineTools.DEFAULT%"
                        assemblyFilters = "build/*.dll"
                    }
                }
            </code>
        </example>
        <example>
            <description>
                Runs [`dotnet test`](https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-test) for the specified test assemblies.
            </description>
            <code>
                dotnetTest {
                    projects = "tests/*.dll"
                    excludedProjects = "tests/ExcludedTests.dll"
                    skipBuild = true
                }
            </code>
        </example>
    </examples>
</dsl-extension>