Newman:
try{
Write-Host "Executing Newman cmdline: & "$TestNewmanPath" run $TestNewmanArgs "
if (test-path $TestNewmanResultPath) {Remove-Item –path "$TestNewmanResultPath" –recurse}
New-Item -ItemType "directory" -path "$TestNewmanResultPath"
if (test-path $TestNewmanLogPath) {Remove-Item –path "$TestNewmanLogPath" –recurse}
New-Item -ItemType "directory" -path "$TestNewmanLogPath"
$args = "run $TestNewmanArgs"
$process = Start-Process "$TestNewmanPath" $args -Wait -PassThru
Write-Host 'Exit code = $($process.ExitCode)'
$compress = @{
Path= "$TestNewmanLogPath*"
CompressionLevel = "Fastest"
DestinationPath = "$TestNewmanLogPath\Logs.zip"
}
Compress-Archive @compress
New-OctopusArtifact -Path "$TestNewmanResultFile" -Name "NewmanResults.html"
New-OctopusArtifact -Path "$TestNewmanLogPath\Logs.zip" -Name "Logs.zip"
if ($process.ExitCode -eq 0){
Write-Host "Newman cmdline complete"
} else {
Write-Error "Newman cmdline failed"
}
<#}catch
{
Write-Warning "WARNING!!!: Some tests have failed , please debug the failures before deploying to other enviroments."
Exit 0
}
>
protractor:
try{
Write-Host "Executing Protractor cmdline: & "$TestProtractorPathAndName" $TestProtractorArgs "
if (test-path $TestProtractorResultPath) {Remove-Item –path "$TestProtractorResultPath" –recurse}
New-Item -ItemType "directory" -path "$TestProtractorResultPath"
if (test-path $TestProtractorLogPath) {Remove-Item –path "$TestProtractorLogPath" –recurse}
New-Item -ItemType "directory" -path "$TestProtractorLogPath"
$args = $TestProtractorArgs
Write-Host "Run Protractor scripts"
Write-Host $TestProtractorResultFile
Write-Host $TestProtractorResultFileLabel
$process = Start-Process -FilePath "$TestProtractorPathAndName" -ArgumentList $args -PassThru
$process.WaitForExit()
Write-Host 'Exit code = $process.ExitCode'
$compress = @{
Path= "$TestProtractorResultPath\$DetailedReportPath*"
CompressionLevel = "Fastest"
DestinationPath = "$TestProtractorResultPath\$DetailedReportPath.zip"
}
Compress-Archive @compress
$compress = @{
Path= "$TestProtractorLogPath*"
CompressionLevel = "Fastest"
DestinationPath = "$TestProtractorLogPath\Logs.zip"
}
Compress-Archive @compress
New-OctopusArtifact -Path "$TestProtractorResultPath\$DetailedReportPath.zip" -Name "DetailedReport.zip"
New-OctopusArtifact -Path "$TestProtractorResultFile" -Name "SummaryReport.html"
New-OctopusArtifact -Path "$TestProtractorLogPath\Logs.zip" -Name "Logs.zip"
if ($process.ExitCode -eq 0){
Write-Host "Protractor cmdline complete"
} else {
Write-Error "Protractor cmdline failed"
}
<#}catch { Write-Warning "WARNING!!!: Some tests have failed , please debug the failures before deploying to other enviroments." Exit 0 }#>