Azure devops Azure DevOps测试-运行Cypress测试后未找到xml
在Azure DevPSCI/CD管道中添加了“发布测试结果”任务,测试已成功,但在运行测试后,它抱怨[警告]未找到与**/test-*.xml匹配的测试结果文件。有人能告诉我们如何解决类似的问题吗 发布测试结果任务:配置Azure devops Azure DevOps测试-运行Cypress测试后未找到xml,azure-devops,azure-pipelines,cypress,Azure Devops,Azure Pipelines,Cypress,在Azure DevPSCI/CD管道中添加了“发布测试结果”任务,测试已成功,但在运行测试后,它抱怨[警告]未找到与**/test-*.xml匹配的测试结果文件。有人能告诉我们如何解决类似的问题吗 发布测试结果任务:配置 Test result format= JUnit Test results files= **/test-*.xml Search folder = $(System.DefaultWorkingDirectory) Test results title = Cypress
Test result format= JUnit
Test results files= **/test-*.xml
Search folder = $(System.DefaultWorkingDirectory)
Test results title = Cypress Test Results
注意:我已尝试按如下方式添加搜索文件夹路径:C:\agent\u work\r5\a\drop\ui tests\cypress
package.json来运行测试
"scripts": {
"test": "cypress run --record --key <key value here>"
}
服务器中的我的目录路径:
C:\agent\u work\r5\a\drop\ui tests\cypress我的朋友,我在Azure DevOps上也面临同样的问题。 在我的例子中,生成xml文件的文件夹是repo根目录上的报告,这取决于您如何在cypress.json文件上配置Junit 因此,在我的例子中,解决方案是在azure-pipelines.yml上改变这一点 这就是测试管道的整个设置
# 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如果您使用junit reporter选项,您确定吗?正如这里提到的,cypress run-reporter junit-reporter options mochaFile=results/my test output.xml,toConsole=true。参考:我正在使用Azure DevOps VSTS,如果我选择Junit“命令行”任务选项,它会工作吗?抱歉,我对Azure DevOps非常陌生,并且发现很难设置它。。我的测试现在通过了,但我正在努力在Azure DevOpis中设置测试结果。我认为这不会起作用,请尝试在命令行/Shell操作中运行我建议的命令。我会这样做的
# 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