4

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.

IpsitaDash-MT
  • 1,326
  • 1
  • 3
  • 7
  • Could you please confirm if you are using TFS 2015 or above, as the Test results field should specify a directory not always to be under the System.DefaultWorkingDirectory. Here is the same scenario :https://github.com/Microsoft/azure-pipelines-tasks/issues/3440 – IpsitaDash-MT Jun 24 '21 at 06:04

2 Answers2

1

I had the same trouble. enter image description here

I fixed changing the Agent specification. enter image description here

enter image description here

0

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/

NJS
  • 426
  • 4
  • 15