I am trying to run the VSTEST thru powershell script, the steps start really good and once the Test fails. it doesn’t exit out from that step.
here is the script that i am using…
Write-Output “Running xUnit tests with dotnet and vstest…”
$dotNetVer = dotnet --version
Write-Output “DotNet version: $dotNetVer”
$dirPath = “C:\Octopus\Applications\Dev\automation\3.2.0.1_3”
#$dirPath = $PackageDirectoryPath
Write-Output $dirPath
$testFiles = “Automation.dll”
Write-Output $testFiles
$testFilter = “TestCategory=Regression”
Write-Output $testFilter
$xUnitAdditionalParams = $XUnitAdditionalParameters
cd $dirPath
cd …
$TestAdapterPathFile=pwd
Write-Output $TestAdapterPathFile
If(-Not $dirPath){
Write-Output “Directory with tests is missing!”
exit 1
}
If(-Not $testFiles){
Write-Output “Test Package(s) missing!”
exit 1
}
Write-Output “Execute test package(s): $testFiles”
Write-Output “With following filter(s): $testFilter”
Write-Output “From Package Directory: $dirPath”
cd “$dirPath\TestPlatform”
dir
If($testFilter){
$runxUnit = “dotnet vstest ‘$dirPath$testFiles’ /testcasefilter:’$testFilter’ /logger:‘trx’ /TestAdapterPath:’$TestAdapterPathFile’”
Write-Output “Run xUnit with filter $testFilter”
#Write-Output “Run xUnit with filter $runxUnit”
} Else {
$runxUnit = “.\vstest.console.exe ‘$dirPath$testFiles’ /logger:‘trx’ /TestAdapterPath:’$TestAdapterPathFile’”
}
if($xUnitAdditionalParams){
$runxUnit = $runxUnit + " " + $xUnitAdditionalParams
Write-Output “Run xUnit with Additional Params $xUnitAdditionalParams”
}
Write-Output “Run xUnit with command: $runxUnit”
iex $runxUnit
$xunitExit = $lastExitCode
Write-Output “==="
Write-Output "===”
Write-Output $xunitExit
exit $lastExitCode
exit
Octopus job stuck in there for almost 11hrs