Search code examples
azureazure-devopsazure-pipelinesplaywrightallure

Allure report in azure devops with e2e tests result


I am using azure devops with playwright e2e tests, but I do not know how could I publish the allure report inside the pipeline (local is good)

I installed the extension, the pipeline is good just no generate allur report part of my yml:

jobs:
- job: AutomatedTests
  steps:
  - task: NodeTool@0
    inputs:
      versionSpec: '14.x'
      cache: 'npm'
    displayName: 'Install Node.js'

  - script: npm install
  - script: npx playwright install --with-deps

    displayName: "run the test"
    condition: succeeded()
  - script: npm run smoke
  - script: npm run generate

  - task: AllureGenerate
    inputs:
      resultsDir: 'allure-results'
      targetDir: 'allure-report/$(Build.BuildNumber)'

Can anybody help me pls?Thanks in advance


Solution

  • Given that you export your test results in a compatible framework type, you could use the PublishTestResults task to do what you need. mergeTestResults should be used if you have more than one result file that you need to be uploaded.

    - task: PublishTestResults@2
      displayName: publish unit test results
      inputs:
        testResultsFormat: 'VSTest'
        testResultsFiles: 'file*.extension'
        searchFolder: 'allure-report/$(Build.BuildNumber)'
        testRunTitle: Unit test results for $(Build.BuildNumber)
        buildConfiguration: debug
        mergeTestResults: true
    

    Based on your export format you should select between 'JUnit' # Options: JUnit, NUnit, VSTest, xUnit, cTest

    https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/test/publish-test-results?view=azure-devops&tabs=trx%2Cyaml