我正在尝试在 Azure Devops 中创建一个构建管道
- 运行在 TestCafe Studio 中创建的测试
- 保存错误截图,并保存每次测试的视频
- 保存测试运行的视频
- 将测试结果发布到测试运行
- 将屏幕截图和视频作为附件发布到构建管道和生成的测试运行中的其余结果
对于我的一生,我和我的团队都无法弄清楚如何做到这一点 - 我们目前处于保存测试运行,并将视频和屏幕截图保存为工件的状态,但它们都没有附加到测试结果中构建或测试运行 - 这是我们的 YAML 文件之一的示例
# ASP.NET
# Build and test ASP.NET projects.
# Add steps that publish symbols, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/apps/aspnet/build-aspnet-4
trigger:
- master
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: VSTest@2
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: NodeTool@0
inputs:
# Replace '10.14' with the latest Node.js LTS version
versionSpec: '10.14'
displayName: 'Install Node.js'
- script: npm install -g testcafe testcafe-reporter-xunit
displayName: 'Install TestCafe'
- script: npm install --save @ffmpeg-installer/ffmpeg
displayName : Install FFMpeg
- script: npm install testcafe-reporter-nunit3
displayName: Install NUnit
- script: testcafe chrome **/Tests/**/* -S -s takeOnFails=true --video --reporter spec,xunit:report.xml
displayName: Run tests - Save screenshots and videos
continueOnError: true
- task: PublishTestResults@2
displayName: Publish test results
continueOnError: true
inputs:
testResultsFiles: '**/report.xml'
searchFolder: $(System.DefaultWorkingDirectory)
testResultsFormat: 'NUnit'
publishRunAttachments: true
testRunTitle: "Task Results"
failTaskOnFailedTests: false
- task: CopyFiles@2
inputs:
sourceFolder: '$(Build.SourcesDirectory)'
contents: '**/?(*0.png|*1.png|*2.png|*3.png|*4.png|*5.png|*6.png|*7.png|*8.png|*9.png|*.mp4)'
targetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: Saved failure screenshots
我们似乎遗漏了一些明显的步骤,但我们都找不到它,经过详尽的搜索,我们都找不到解决方案。我们缺少什么?