Reputation: 3389
I'm trying the REST APIs available in Azure DevOps. The intention of it is to trigger the test cases (angular application) programmatically. I've defined the pipeline and able to successfully invoke it using the Run API. In the pipeline definition yaml file, we have the below task
- task: PublishTestResults@3
displayName: 'Publish unit testing results'
inputs:
searchFolder: $(System.DefaultWorkingDirectory)/unit-test-reports
testRunTitle: myngapp ui
testResultsFormat: JUnit
testResultsFiles: '**/TESTS*.xml'
This checks the TESTS*.xml file to create a report.
I wanted to access these files via the API. Is it possible for me to access these files via the API?
Upvotes: 0
Views: 1053
Reputation: 7241
You can first archive the files and then publish the build artifact.
pool:
vmImage: ubuntu-latest
steps:
- script: echo Hello, world!
displayName: 'Run a one-line script'
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(Build.BinariesDirectory)'
includeRootFolder: true
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
replaceExistingArchive: true
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
After that, you should be able to use this REST API to get the files:
Upvotes: 1