无法在Azure DevOps CD管道中获取我的Postman HTML报告

dwbf0jvd  于 2022-11-07  发布在  Postman
关注(0)|答案(1)|浏览(176)

我正在尝试在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 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 报告都工作正常,我有什么想法吗?

jtoj6r0c

jtoj6r0c1#

我觉得你给的路不对,从你本地的系统看,理想的应该是

$(System.DefaultWorkingDirectory)

如果您可以对cwdsearchFolder发布任务进行以下更正,它应该会起作用
如果您尝试更改D:\Automation\Postman\Scripts,则会显示此值

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

相关问题