You have to use the following task :
PublishTestResults@2
E.g. This is what I use to publish a test result from the OWASP code analysis app
- task: PublishTestResults@2
displayName: 'Publish Dependency Check Test Results'
inputs:
testResultsFiles: 'dependency-check-junit.xml'
searchFolder: '/home/vsts/work/1/TestResults/dependency-check/'
testRunTitle: 'Dependency Check'
What you need to do is create a report following the formatting specification described in this link and target the directory where you saved (searchFolder) it (and possibly the name of the file in testResultsFiles) in the publishtestresults task.
The owasp task I am referencing is this:
dependency-check.dependencycheck.dependency-check-build-task.dependency-check-build-task@6
and here is the code for the whole task if you want to test it in your application (we analyze a package.json and package-lock.json in our case)
- task: dependency-check.dependencycheck.dependency-check-build-task.dependency-check-build-task@6
displayName: 'Dependency Check'
inputs:
projectName: dependencies-check
scanPath: '**/*.json'
warnOnCVSSViolation: true
format: 'ALL'
continueOnError: true
- task: PublishTestResults@2
displayName: 'Publish Dependency Check Test Results'
inputs:
testResultsFiles: 'dependency-check-junit.xml'
searchFolder: '/home/vsts/work/1/TestResults/dependency-check/'
testRunTitle: 'Dependency Check'
the result will be displayed in your pipeline screen under Tests
