在Publish test results
CI / CD管道中添加了Azure DevOps
任务,测试成功,但是在运行测试后,它抱怨了##[warning]No test result files matching **/test-*.xml were found.
,请问有人可以建议我们如何解决类似的问题?
发布测试结果任务:配置
Test result format= JUnit
Test results files= **/test-*.xml
Search folder = $(System.DefaultWorkingDirectory)
Test results title = Cypress Test Results
注意: 我尝试如下添加search folder
路径: C:\ agent_work \ r5 \ a \ drop \ ui-tests \ cypress < / p>
package.json 来运行测试
"scripts": {
"test": "cypress run --record --key <key value here>"
}
我在服务器中的目录路径: C:\ agent_work \ r5 \ a \ drop \ ui-tests \ cypress
答案 0 :(得分:1)
我的朋友,我在Azure DevOps上遇到了同样的问题。
在我的情况下,生成xml文件的文件夹是存储库根目录上的报告,这取决于您如何在cypress.json
文件上配置Junit
所以对于我来说,解决方案是在azure-pipelines.yml
testResultsFiles: "results/*.xml"
searchFolder: $(System.DefaultWorkingDirectory)
这就是测试管道的整个设置
# Node.js
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
steps:
- task: NodeTool@0
inputs:
versionSpec: '12.x'
displayName: 'Install Node.js'
- script: "npm i"
displayName: "Install project dependencies"
- script: "npm run cy:verify"
displayName: "Cypress Verify"
- script: "source cypress.env" # comment this script to run tests against production
displayName: "Using env variables to change url to test against development branch"
- script: "npm run cy:run-report"
displayName: "Run Cypress Tests"
- task: PublishBuildArtifacts@1
displayName: "Publish Artifact: cypress-azure-devops screenshots"
inputs:
PathtoPublish: cypress/screenshots
ArtifactName: "CypressAzureDevopsTestRunScreenshots"
condition: failed()
- task: PublishTestResults@2
displayName: "Publish Test Results"
condition: succeededOrFailed()
inputs:
testResultsFormat: "JUnit"
testResultsFiles: "results/*.xml"
searchFolder: $(System.DefaultWorkingDirectory)
mergeTestResults: true
testRunTitle: 'Test Results'
continueOnError: true
Saludos desde Argentina??