Octopus.Script exported 2014-05-06 by bobjwalker belongs to ‘NUnit’ category.
Runs NUnit tests from a list of assemblies.
Parameters
When steps based on the template are included in a project’s deployment process, the parameters below can be set.
NUnit path
NUnitExePath
The path to nunit-console.exe
. If this is not provided it will be assumed that the executable is on the PATH. Example: C:\Program Files (x86)\NUnit 2.6.3\bin\nunit-console.exe.
Working directory
NUnitWorkingDirectoryPath
The folder that contains the test assemblies. Generally this will be bound to an output variable from a previous step. Example: #{Octopus.Action[Deploy integration tests].Output.Package.InstallationDirectoryPath}
Test assemblies
NUnitTestAssemblies
A semicolon-separated list of assembly names containing tests. Example: MyCompany.IntegrationTests.dll; MyCompany.SmokeTests.dll
Additional arguments
NUnitAdditionalArgs = /nodots
Additional arguments to the NUnit command-line tool. For a full list of supported flags and options see the NUnit documentation.
Script body
Steps based on this template will execute the following PowerShell script.
Write-Output "Running NUnit tests..."
$exePath = '"' + $NUnitExePath + '"'
if (-not $exePath) {
$exePath = "nunit-console.exe"
}
$runNUnit = "& $exePath /out:TestStdOut.txt /err:TestStdErr.txt $NUnitAdditionalArgs"
$NUnitTestAssemblies.Split(";") | ForEach {
$asm = $_.Trim()
Write-Output "Including assembly $asm"
$runNUnit += " $asm"
}
cd $NUnitWorkingDirectoryPath
iex $runNUnit
$nunitExit = $lastExitCode
New-OctopusArtifact -Path TestResult.xml
New-OctopusArtifact -Path TestStdOut.txt
New-OctopusArtifact -Path TestStdErr.txt
exit $nunitExit
Provided under the Apache License version 2.0.
To use this template in Octopus Deploy, copy the JSON below and paste it into the Library → Step templates → Import dialog.
{
"Id": "edcacbb5-6776-445a-9555-576ee4c3e2d6",
"Name": "Test - Run NUnit",
"Description": "Runs NUnit tests from a list of assemblies.",
"Version": 10,
"ExportedAt": "2014-05-06T04:23:41.674+00:00",
"ActionType": "Octopus.Script",
"Author": "bobjwalker",
"Parameters": [
{
"Name": "NUnitExePath",
"Label": "NUnit path",
"HelpText": "The path to `nunit-console.exe`. If this is not provided it will be assumed that the executable is on the PATH. Example: _C:\\Program Files (x86)\\NUnit 2.6.3\\bin\\nunit-console.exe_.",
"DefaultValue": null,
"DisplaySettings": {
"Octopus.ControlType": "SingleLineText"
}
},
{
"Name": "NUnitWorkingDirectoryPath",
"Label": "Working directory",
"HelpText": "The folder that contains the test assemblies. Generally this will be bound to an output variable from a previous step. Example: _#{Octopus.Action[Deploy integration tests].Output.Package.InstallationDirectoryPath}_",
"DefaultValue": null,
"DisplaySettings": {
"Octopus.ControlType": "SingleLineText"
}
},
{
"Name": "NUnitTestAssemblies",
"Label": "Test assemblies",
"HelpText": "A semicolon-separated list of assembly names containing tests. Example: _MyCompany.IntegrationTests.dll; MyCompany.SmokeTests.dll_",
"DefaultValue": null,
"DisplaySettings": {
"Octopus.ControlType": "SingleLineText"
}
},
{
"Name": "NUnitAdditionalArgs",
"Label": "Additional arguments",
"HelpText": "Additional arguments to the NUnit command-line tool. For a full list of supported flags and options see [the NUnit documentation](http://www.nunit.org/index.php?p=consoleCommandLine&r=2.6.3).",
"DefaultValue": "/nodots",
"DisplaySettings": {
"Octopus.ControlType": "SingleLineText"
}
}
],
"Properties": {
"Octopus.Action.Script.ScriptBody": "Write-Output \"Running NUnit tests...\"\n\n$exePath = '\"' + $NUnitExePath + '\"'\nif (-not $exePath) {\n $exePath = \"nunit-console.exe\"\n}\n\n$runNUnit = \"& $exePath /out:TestStdOut.txt /err:TestStdErr.txt $NUnitAdditionalArgs\"\n\n$NUnitTestAssemblies.Split(\";\") | ForEach {\n $asm = $_.Trim()\n Write-Output \"Including assembly $asm\"\n $runNUnit += \" $asm\"\n}\n\ncd $NUnitWorkingDirectoryPath\n\niex $runNUnit\n$nunitExit = $lastExitCode\n\nNew-OctopusArtifact -Path TestResult.xml\nNew-OctopusArtifact -Path TestStdOut.txt\nNew-OctopusArtifact -Path TestStdErr.txt\n\nexit $nunitExit\n",
"Octopus.Action.Script.Syntax": "PowerShell"
},
"Category": "NUnit",
"HistoryUrl": "https://github.com/OctopusDeploy/Library/commits/master/step-templates//opt/buildagent/work/75443764cd38076d/step-templates/test-run-nunit.json",
"Website": "/step-templates/edcacbb5-6776-445a-9555-576ee4c3e2d6",
"Logo": "iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAMAAACahl6sAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAD9QTFRFX5ljq8qu////kLmTAFwC1OPVK3gvDWUQw9nF6/Lr5O7l9fn18fbx+Pr4N4A6+/z7HG8gR4pLdqh5/f793urfPTOpfwAADKRJREFUeNrsnemaq6oSQKGJgBOj7/+sxwSSIJNgMN37Xv3Or7PtyKKogQIK8PM/8oAL5AK5QC6QC+QCuUAukAvkArlALpAL5AK5QC6QfxNE82npNk/P+b8GokcKoQIMY/c/oBCEM/83QDRfKJLsln6EBLSb+N8GmSlggtz2HiKYRKP+qyAQMhE2GkulFMAhHcEK9n8ORHdQRURBGOqGdRRNHQQiNspQ1/8lED1AHB1C6t1MHn9FKDr/FZB+VYyoXgg0Oq9xGjcBeBXLXwDRNDZoHvJAnmmiOPEia6AsH4KMnUwaKTX6b9PkuxgNvwpCQdrWkqCX9aTSb2OkfwtELyjnMmINW3DmDwDVvwIyIEbSDg+oJeYwIZA4Pb7UByjguI6nGoQBopOON0nreXUpMoXCoP4ySA9JIpBCg/7RueZoE8okBAM6/U2QJW6rJCz1CJr3CZEKyr8GomHMta3RSM18Y5XaBGMsBC1fAtFIxKKRI5+fYnELkforIDxidDGafPu0jFFT5zuXkUZGqRy+ANKHHOug0psQkkLFGIz9MWCrSVumbagWooCOnw3SKf+rBCzbLkbyMfRYZIA8bB1hwI2t9M8cjtV6Owwq1Tz4pKTumKfq/ULYlu5tJAAcnE7vVfC7aNLngeggfhWucsxq4+txYIvB1m92bvDJAutxHoj2o1fiaCUPBx3bOjceGFsJ+Tvv4useAaeB+LZSqOHNqCKGFLuzvy7iNISjLbPvnYiazgFZvHGM4cvCTig+uVq9i37GNPH5IXkPMO2bL4JOAemBZyKHt1sT6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