【问题标题】:Cannot get my Postman HTML report in Azure DevOps CD pipeline无法在 Azure DevOps CD 管道中获取我的 Postman HTML 报告
【发布时间】:2022-09-26 12:00:21
【问题描述】:

我正在尝试在 Azure DevOps 中为我的发布管道获取 Postman HTML 报告。

这里的任务。

steps:
- task: jungeriusit.jungit-robocopy.jungit-robocopy.Robocopy@1
  displayName: \'Copy Test Collateral\'
  inputs:
    source: \'$(System.DefaultWorkingDirectory)/_cdproject/Postman\'
    destination: \'D:\\Automation\\Postman\'
    files: \'*.json,*.xml,*.ps1,*psm1,*.txt,*.cmd,*.html\'
    copySubDirs: true
    copySubDirsAll: false
    purge: true
    move: false
    createtree: false
    excludeFiles: \'*.md\'
    excludeDirs: \'$(System.DefaultWorkingDirectory)\\_cdproject\\Postman\\Archive $(System.DefaultWorkingDirectory)\\_cdproject\\Postman\\DocumentsAndOthers $(System.DefaultWorkingDirectory)\\_cdproject\\Postman\\SDS $(System.DefaultWorkingDirectory)\\_cdproject\\Postman\\SharePoint 
    retries: 3

    - task: UseNode@1
      displayName: \'Node install\'
      inputs:
        version: 16.x
        checkLatest: true
    
    - task: Npm@1
      displayName: \'npm install newman\'
      inputs:
        command: custom
        workingDir: \'D:\\Automation\\Postman\\Scripts\'
        verbose: false
        customCommand: \'install newman -g\'
      continueOnError: true
    
    - task: Npm@1
      displayName: \'npm install html report\'
      inputs:
        command: custom
        workingDir: \'D:\\Automation\\Postman\\Scripts\'
        verbose: false
        customCommand: \'install -g newman-reporter-htmlextra\'
      continueOnError: true

然后我有一个 PowerShell 脚本做一些其他的事情,最后是 newman 命令。

\"newman run \'\" + $runnerFileFullName + $globalSecrets + \"\' -e \'\" + $environmentFileFullName + $environmentParam + \"\' --insecure --disable-unicode --color \" + $color + \" -r htmlextra --reporters \'cli,junit,json,htmlextra\' --reporter-json-export \'\" + $reportFile + \"\'\"

最后尝试发布报告。

- task: MaciejMaciejewski.postman-report.UploadPostmanHtmlReport.UploadPostmanHtmlReport@1
  displayName: \'Upload Postman Html Report\'
  inputs:
    cwd: \'D:\\Automation\\Postman\\Scripts\'
  continueOnError: true

- task: PublishTestResults@2
  displayName: \'Publish Test Results\'
  inputs:
    testResultsFiles: \'**/*.xml\'
    searchFolder: \'D:\\Automation\\Postman\\Scripts\'
    mergeTestResults: true
    testRunTitle: Results
  continueOnError: true

最后 JUnit 和邮递员报告都在工作,知道我做错了什么吗?

    标签: postman azure-pipelines postman-collection-runner


    【解决方案1】:

    我认为您提供的路径不正确,从您的本地系统看起来像,理想情况下应该是

    $(System.DefaultWorkingDirectory)
    

    如果您可以进行以下更正以发布任务cwd搜索文件夹,它应该工作

    如果您尝试更改此值D:\自动化\邮递员\脚本

    steps:
    - task: UploadPostmanHtmlReport@1
      displayName: 'Upload Postman Html Report'
      inputs:
        cwd: '$(System.DefaultWorkingDirectory)'
        tabName: 'Postman Test'
    
    - task: PublishTestResults@2
      displayName: 'Publish Test Results'
      inputs:
        testResultsFiles: '**/*.xml'
        searchFolder: '$(System.DefaultWorkingDirectory)'
        mergeTestResults: true
        testRunTitle: Results
      continueOnError: true
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-04-07
      • 2020-02-04
      • 2019-07-14
      • 2020-10-13
      • 1970-01-01
      • 2020-12-20
      相关资源
      最近更新 更多