Forum Discussion

thanujapathiraja's avatar
thanujapathiraja
Copper Contributor
Aug 12, 2024

##[error]PowerShell exited with code '1'

When I run Newman in the pipeline if there is failure, it stop the rest of the pipeline.

 

##[error]PowerShell exited with code '1'.

Finishing: Run newman
 
I need to continue the pipeline.
 
- task: PowerShell@2
  displayName: Run newman
  inputs:
    targetType: 'inline'
    script: 'newman run $(System.DefaultWorkingDirectory)/test/postman_collection.json -r htmlextra --reporters cli,htmlextra,junit --reporter-junit-export $(System.DefaultWorkingDirectory)/test/Results/junitReport.xml --reporter-htmlextra-export $(System.DefaultWorkingDirectory)/test/report/TestReport.html'
    errorActionPreference: 'continue'
    condition: succeededOrFailed()  
 
 
Can anyone help me on this?
 
This runs perfectly when there is no assertion failure. 
 
  • thanujapathiraja 

     

    How about this:

     

    - task: PowerShell@2
    displayName: Run newman
    inputs:
    targetType: 'inline'
    script: 'newman run $(System.DefaultWorkingDirectory)/test/postman_collection.json -r htmlextra --reporters cli,htmlextra,junit --reporter-junit-export $(System.DefaultWorkingDirectory)/test/Results/junitReport.xml --reporter-htmlextra-export $(System.DefaultWorkingDirectory)/test/report/TestReport.html'
    errorActionPreference: 'continue'
    continueOnError: true
    condition: succeededOrFailed()

  • thanujapathiraja 

     

    How about this:

     

    - task: PowerShell@2
    displayName: Run newman
    inputs:
    targetType: 'inline'
    script: 'newman run $(System.DefaultWorkingDirectory)/test/postman_collection.json -r htmlextra --reporters cli,htmlextra,junit --reporter-junit-export $(System.DefaultWorkingDirectory)/test/Results/junitReport.xml --reporter-htmlextra-export $(System.DefaultWorkingDirectory)/test/report/TestReport.html'
    errorActionPreference: 'continue'
    continueOnError: true
    condition: succeededOrFailed()

    • thanujapathiraja's avatar
      thanujapathiraja
      Copper Contributor
      task: PowerShell@2
      displayName: Run newman
      inputs:
      targetType: 'inline'
      script: 'newman run $(System.DefaultWorkingDirectory)/test/postman_collection.json -r htmlextra --reporters cli,htmlextra,junit --reporter-junit-export $(System.DefaultWorkingDirectory)/test/Results/junitReport.xml --reporter-htmlextra-export $(System.DefaultWorkingDirectory)/test/report/TestReport.html --bail false'
      ignoreLastExitCode: true
      condition: always()

      finally solved. Thanks for the help kidd_lp 🙂

Resources