[英]Newman with AzureDevOps + Powershell
大家,早安
我正在尝试将 postman 测试与 AzureDevops 发布管道集成。 我有两个步骤:
第二步看起来像:
try
{
$testFiles = Get-ChildItem *.postman_collection.json -Recurse
$environmentFile = Get-ChildItem *staging.postman_environment.json -Recurse
Write-Host $testFiles.Count files to test
foreach ($f in $testFiles)
{
$environment = $environmentFile[0].FullName
Write-Host running file $f.FullName
Write-Host usting environment $environment
$collection = $f.FullName
$resultFile = "Results\" + $f.BaseName + ".xml"
Write-Host running $collection
Write-Host will create $resultFile
$(newman run $collection -e $environment -r junit --reporter-junit-export $resultFile)
}
}
catch
{
Write-Host "Exception occured"
Write-Host $_
}
上述步骤未按预期工作。 在发布日志中,我可以看到两条消息,例如:
Write-Host running $collection
Write-Host will create $resultFile
然而线
$(newman run $collection -e $environment -r junit --reporter-junit-export $resultFile)
没有被执行。
我在我的本地机器上做了同样的事情,并且命令正在运行。 然而,不好的是 try catch 块不起作用,只有我能看到结果是:
2019-11-22T15:11:23.8332717Z ##[error]PowerShell exited with code '1'.
2019-11-22T15:11:23.8341270Z ##[debug]Processed: ##vso[task.logissue type=error]PowerShell exited with code '1'.
2019-11-22T15:11:23.8390876Z ##[debug]Processed: ##vso[task.complete result=Failed]Error detected
2019-11-22T15:11:23.8414283Z ##[debug]Leaving D:\a\_tasks\PowerShell_e213ff0f-5d5c-4791-802d-52ea3e7be1f1\2.151.2\powershell.ps1.
有谁知道如何在 AzureDevOps 中遇到真正的错误或有过新人测试的经验?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.