我有一个 PowerShell 脚本,可以运行一些纠缠测试、写入变量并导出:
$pesterContainer = New-PesterContainer -Path './Pester.Tests.ps1' -Data @{ Object = $testObject}
$pesterResult = Invoke-Pester -Container $pesterContainer -PassThru -Tag 'Tag'
$pesterResult | ConvertTo-JUnitReport | Export-Clixml -Path "./test-results.xml"
该脚本作为 YAML 管道的一部分被调用。作为管道中的最后一个任务,我想发布测试结果,如下所示:
steps:
- checkout: self
- task: PowerShell@2
inputs:
targetType: filePath
filePath: ./Tests/Test-Stuff.ps1
arguments: -arguments $arg
failOnStderr: false
errorActionPreference: continue
ignoreLASTEXITCODE: true
- task: PublishTestResults@2
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: '**/test-results.xml'
testRunTitle: 'title'
mergeTestResults: true
无论出于何种原因,这都不起作用,PublishTestResults 任务返回“未找到要发布的结果'D:\a\1\s\test-results.xml'.”消息。
我尝试使用 windows-latest 代理池而不是 ubuntu-latest 并得到相同的结果。
我尝试使用 NUnit 而不是 JUnit(在脚本和管道中)并收到“无法解析结果文件:System.NotSupportedException:文件格式无效。”消息。
有什么想法吗?