Reputation: 743
I am running my build and release pipeline in TFS/AZureDevopsServer-2019, below is the YAML used in azure-pipeline.yml
When the pipeline runs it does not generate Analytics
How ever as per " https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/test/publish-test-results?view=azure-devops&tabs=trx%2Cyaml " i have added below task in my pipeline
- task: Maven@3
inputs:
mavenPomFile: '$(System.DefaultWorkingDirectory)/maven/pom.xml'
goals: package
mavenAuthenticateFeed: true
sonarQubeRunAnalysis: true
publishJUnitResults: true
sqMavenPluginVersionChoice: 'latest'
- task: PublishTestResults@2
inputs:
testResultsFormat: 'JUnit'
searchFolder: '$(System.DefaultWorkingDirectory)'
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
codeCoverageToolOption: JaCoCo
Pipeline result
2021-03-30T17:11:52.9179560Z ##[warning]No test result files matching **/TEST-*.xml were found.
Upvotes: 2
Views: 20294
Reputation: 327
If someone is working with agent deployed on Windows machine, here is a tip. I suggest not to specify $(System.DefaultWorkingDirectory)
for the test results path. The test runner creates 'test results' files relative to current working directory. For example, if you are running junit, then you can specify --junit-directory /reports
, the agent creates a /reports
folder under current working directory and .xml
file will be placed under /reports
. On the contrary, specifying $(System.DefaultWorkingDirectory)/reports
has some undesirable results.
Upvotes: 0
Reputation: 31003
The error message has indicated there is no test result files matching **/TEST-*.xml. You need to check whether you have a test task in your pipeline, and check the log after running the test task, to check whether the test file has been generated.
In addition, the default option uses JUnit format to publish test results. **/TEST-*.xml
searches for all the XML files whose names start with TEST-
in all subdirectories. If using VSTest as the testRunner, the testResultsFiles option should be changed to **/TEST-*.trx
.
Upvotes: 3