How to install nUnit 3 nunit3-console.exe in TeamCity 9.x

后端 未结 8 1075
没有蜡笔的小新
没有蜡笔的小新 2021-02-07 06:19

NUnit 3.0 is supported by TeamCity 9.1.x now however you have to install the runner and specify the path to the nunit3.console.exe in the step. My question is where do I copy t

8条回答
  •  难免孤独
    2021-02-07 06:55

    Try latest version of script @NathanAldenSr

    Still required variable http://teamcityserver/admin/editProject.html?projectId=yourId&tab=projectParams add nunit.consolerunner.directory parameter to Configuration Parameters

    $SrcDirectory = "%teamcity.build.checkoutDir%"
    $PackagesDirectory = Join-Path $SrcDirectory packages
    
    Write-Output "PackagesDirectory" $PackagesDirectory
    
    $NUnitConsoleRunnerPackageDirectory = Get-ChildItem (Join-Path $PackagesDirectory NUnit.ConsoleRunner.*) | %{
        @{
            Directory = $_.FullName
            Version = [Version]::Parse(($_.Name -replace "NUnit.ConsoleRunner.",""))
        }
    } | Sort-Object Version -Descending | Select-Object -First 1 | %{ $_.Directory }
    
    if (!$NUnitConsoleRunnerPackageDirectory) {
        throw [IO.DirectoryNotFoundException] "NUnit console runner package directory not found"
    }
    
    $NUnitConsoleRunnerPackageDirectory = Join-Path $NUnitConsoleRunnerPackageDirectory tools
    
    Write-Output "NUnitConsoleRunnerPackageDirectory" $NUnitConsoleRunnerPackageDirectory
    Write-Output "##teamcity[setParameter name='nunit.consolerunner.directory' value='$NUnitConsoleRunnerPackageDirectory']"
    

提交回复
热议问题