Azure devops 无法在azure devops中查看邮递员测试结果

Azure devops 无法在azure devops中查看邮递员测试结果,azure-devops,postman,Azure Devops,Postman,我有一些邮递员收藏,我想在azure devops中运行它们, 不管出于什么原因,我的测试没有公布 我错过了什么? 如果我删除“reporters:junit”,我可以在步骤中看到结果。我希望在摘要旁边有一个选项卡“test” resources: - repo: self clean: true queue: name: Hosted VS2017 demands: npm steps: - task: Npm@1 displayName: 'npm install' i

我有一些邮递员收藏,我想在azure devops中运行它们, 不管出于什么原因,我的测试没有公布

我错过了什么? 如果我删除“reporters:junit”,我可以在步骤中看到结果。我希望在摘要旁边有一个选项卡“test”

resources:
- repo: self
  clean: true
queue:
  name: Hosted VS2017
  demands: npm

steps:
- task: Npm@1
  displayName: 'npm install'
  inputs:
    verbose: false    
    customCommand: 'install newman -g'
 
- task: NewmanPostman@4
  displayName: 'Postman tests'
  inputs:
    collectionFileSource: 'my.postman_collection.json'
    environmentSourceType: none
    reporters: junit
    ignoreRedirect: false
    bail: false    
    sslInsecure: false
    htmlExtraDarkTheme: false
    htmlExtraLogs: false
    htmlExtraTestPaging: false

- task: PublishTestResults@2
  inputs:
    testResultsFormat: 'JUnit' # Options: JUnit, NUnit, VSTest, xUnit
    testResultsFiles: '**/*.xml'       

Junit报告在当前目录的newman文件夹中生成。您将此位置更改为:

--reporter-junit-export a.xml 
--reporter-junit-export folder/a.xml
这将在指定的文件夹/目录中以.xml或.xml格式生成报告

您必须使用publishtest结果发布该结果,如果您没有使用--reporter junit export,那么请确保所有步骤的workingdirectory都相同

否则,请给出完整路径,如下所示:

--reporter-junit-export c:/folder/a.xml

在步骤中,给出报告的完整路径:

- task: PublishTestResults@2
  inputs:
    testResultsFormat: 'JUnit' # Options: JUnit, NUnit, VSTest, xUnit
    testResultsFiles: 'c:/folder/a.xml' 
我遗漏了什么?如果我删除“记者:junit”,我可以在步骤中看到结果。我希望在摘要旁边有一个标签“test”

resources:
- repo: self
  clean: true
queue:
  name: Hosted VS2017
  demands: npm

steps:
- task: Npm@1
  displayName: 'npm install'
  inputs:
    verbose: false    
    customCommand: 'install newman -g'
 
- task: NewmanPostman@4
  displayName: 'Postman tests'
  inputs:
    collectionFileSource: 'my.postman_collection.json'
    environmentSourceType: none
    reporters: junit
    ignoreRedirect: false
    bail: false    
    sslInsecure: false
    htmlExtraDarkTheme: false
    htmlExtraLogs: false
    htmlExtraTestPaging: false

- task: PublishTestResults@2
  inputs:
    testResultsFormat: 'JUnit' # Options: JUnit, NUnit, VSTest, xUnit
    testResultsFiles: '**/*.xml'       
根据我的测试,我可以复制你的问题

以下是您需要检查的几点:

  • 发布测试结果任务中的XML文件路径
  • 默认情况下,Junit xml文件将保存在newman文件夹中。

    您可以使用以下路径设置文件路径:

    - task: PublishTestResults@2
      displayName: 'Publish Test Results **/*/*.xml'
      inputs:
        testResultsFiles: '**/*/*.xml'
    
    您还可以在NewmanPostman任务中更改Junit文件输出路径:reporterJUnitExport字段

    示例:

    - task: NewmanPostman@4
      displayName: 'Newman - Postman'
      inputs:
        collectionFileSource: '$(build.sourcesdirectory)'
        Contents: 'kevintest123.postman_collection.json'
        environmentSourceType: none
        ignoreRedirect: false
        bail: false
        sslInsecure: false
        reporters: junit
        htmlExtraDarkTheme: false
        htmlExtraLogs: false
        htmlExtraTestPaging: false
        reporterJUnitExport: '$(Build.sourcesdirectory)\Results\junitReport.xml'
    
  • 您需要确保Json文件包含测试。在Postman中导出文件时,需要在测试选项卡中添加内容:
  • 这是一份关于你的文件

    然后,您可以通过发布测试Restlt任务将测试结果成功发布到测试选项卡

    或者,您将遇到以下问题,并且测试结果Junit xml文件不包含测试结果:

    更新:

    - task: NewmanPostman@4
      displayName: 'Newman - Postman'
      inputs:
        collectionFileSource: '$(build.sourcesdirectory)'
        Contents: 'kevintest123.postman_collection.json'
        environmentSourceType: none
        ignoreRedirect: false
        bail: false
        sslInsecure: false
        reporters: junit
        htmlExtraDarkTheme: false
        htmlExtraLogs: false
        htmlExtraTestPaging: false
        reporterJUnitExport: '$(Build.sourcesdirectory)\Results\junitReport.xml'
    
    在任何地方都找不到“出错后继续”。anyideas

    Yaml编辑器

    - task: PublishTestResults@2
      displayName: 'Publish Test Results **/*/*.xml'
      inputs:
        testResultsFiles: '**/*/*.xml'
      continueOnError: true
    
    经典编辑


    一个接一个地调试它,而不是作为一个整体先保存一个静态的postman junit报告,看看您是否能够发布它,然后删除并运行postman,看看junit是否正在发布。然后添加步骤,每次为新运行删除以前的报告,并验证每次运行是否创建junit,然后将两个解决方案集成在一起,看看出了什么问题对于初学者来说,我刚刚创建了一个集合,通过一个测试来查看是否有效,我可以看到在管道中的步骤是否有效。我对junit report完全陌生,在哪里可以买到?为什么管道不发布报告JUnit报告是在newman的工作目录中的newman文件夹中生成的,您必须使用publishtest结果发布报告MM我在测试中尝试过,但仍然没有成功,让我按照你的步骤来做,看看我是否做了一些不同的事情它是有效的,但是请注意,如果你有一个测试失败,测试摘要不会显示,因为它没有到达publishresult任务。在任何地方都找不到“出错后继续”。anyideas.Hi@developer9969。您可以添加条件以发布测试结果任务。请参阅此文档:请参阅我的更新信息谢谢您的帮助!