Azure DevOps PublishTestResults未找到junit cypress测试结果文件 [英] Azure DevOps PublishTestResults not found junit cypress test result file

查看:36
本文介绍了Azure DevOps PublishTestResults未找到junit cypress测试结果文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Cypress测试在Azure DevOps上设置管道。

本地测试输出文件创建正确。

我正在使用npx cypress运行命令

我收到发布测试结果的错误/警告:

##[警告]未找到与**/test-output-*.xml匹配的测试结果文件。

这是我的cypress.json文件:

    {
    "reporter": "junit",
    "reporterOptions": {
      "mochaFile": "tests/test-output-[hash].xml",
      "toConsole": true,
      "attachments": true
    },
    "video": false,
    "pluginsFile": "cypress/plugins/index.js",
    "supportFile": "cypress/support/index.js"
   }

这里是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:
- develop

pool:
  vmImage: 'ubuntu-latest'

steps:
- task: NodeTool@0
  inputs:
    versionSpec: '10.x'
  displayName: 'Install Node.js'

- script: |
    npm install
  displayName: 'npm install'

- script:
    npx cypress run
  displayName: 'Execute cypress tests'

- task: PublishTestResults@2
  displayName: "Publish Test Results"
  condition: always()
  inputs:
    testResultsFormat: 'JUnit'
    testResultsFiles: '**/test-output-*.xml'
    searchFolder: '$(System.DefaultWorkingDirectory)'

- task: PublishBuildArtifacts@1
  condition: always()
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)'
    ArtifactName: 'drop'
    publishLocation: 'Container'

我试着做所有奇怪的事情,但都没用。 已检查所有StackOverflow主题,如下所示:

Azure DevOps test -xml not found after running the Cypress tests

Is there any way to show Cypress Test Results in Azure DevOps Test Results Tab?

Azure DevOps test -xml not found after running the Cypress tests

No test result files were found using search pattern '...**TEST-*.xml

Cypress Integration with DevOps

根据Cypress文档和博客等进行正确设置。

可能未在Azure上创建测试输出文件?

可能有人有线索?

编辑: 我使用ls -al命令检查,tests文件夹没有创建。 但是,即使我在启动Cypress之前使用mkdir tests创建了它,该文件夹在Cypress作业之后也是空的。 所以赛普拉斯没有创建测试输出报告。为什么在本地创建该文件,而在Azure上不创建?

推荐答案

请检查以下步骤:

  1. 将管道变量system.debug设置为true,然后重新运行管道。
  2. 完成步骤";Execute cypress tests";后,检查是否可以从控制台窗口的调试日志中获取有关疑难解答的更多详细信息。
  3. 您提到相同的npx cypress run命令可以在您的本地计算机上正常工作,请尝试在您的本地计算机上安装自托管代理以运行管道,以查看问题是否仍然存在。

如果问题仍然存在,为了让我们进一步调查此问题,请与我们共享测试步骤的完整日志。

这篇关于Azure DevOps PublishTestResults未找到junit cypress测试结果文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆