No test result files matching **/test-*.xml were found - Azure DevOps

7.7k Views Asked by At

I am trying to publish test results in azure but i am unable to do it. Its my second day with azure so i may be missing something.

My pipeline code is

- task: PublishTestResults@2
  inputs:
    testResultsFormat: 'JUnit'
    testResultsFiles: '**/test-*.xml'

karma.conf.js

junitReporter: {
             outputDir: '.',
             outputFile:'test-report.xml'
         },

And I am using the latest ubuntu. But always when I run pipeline I get this error

##[warning]No test result files matching **/test-*.xml were found.

I tried lowercase uppercase but nothing works and I don't know what I am doing wrong. I will be thankful for any hints.

2

There are 2 best solutions below

0
NJS On

Your PublishTestResults task specifies JUnit, but you need to make sure karma is generating JUnit reports. The snippet you show from karma.conf.js is not enough to verify that.

Did you install karma-junit-reporter npm package?

npm install karma-junit-reporter --save-dev

Did you add karma-junit-reporter in karma.conf.js plugins array?

require('karma-junit-reporter')

Did you add junit in karma.conf.js reporters array?

reporters: ['progress', 'kjhtml', 'junit'],

Then make sure the PublishTestResults task has the correct pattern. Mine looks like this because I don't specify any junitReporter settings, which you show in your example.

testResultsFiles: "**/TESTS*.xml"

I learned a lot from this example: https://www.olivercoding.com/2020-01-02-angular-azure-devops/

0
Flor Campos Flores On

I had the same trouble. enter image description here

I fixed changing the Agent specification. enter image description here

enter image description here