dependency-check / azuredevops

Dependency Check Azure DevOps Extension
Apache License 2.0
45 stars 25 forks source link

No junit report in TestResult #70

Closed fxboga-syfadis closed 3 years ago

fxboga-syfadis commented 3 years ago

I can't generate the junit xml report in the TestResult folder in order to publish it into the Test tab. The only file generated is the html report even if I specify multiple formats

Here is my pipeline configuration:

- task: dependency-check-build-task@6
  displayName: 'OWASP Dependency Check'
  inputs:
    projectName: 'MyProject'
    scanPath: '**/*.csproj'
    excludePath: 'Tests/'
    format: 'HTML,JSON,JUNIT'
#    reportsDirectory: '$(Common.TestResultsDirectory)/dependency-check' 

- task: PublishTestResults@2
  inputs:
    testResultsFormat: 'JUnit'
    testResultsFiles: 'dependency-check/*junit.xml'
    searchFolder: '$(Common.TestResultsDirectory)'
    testRunTitle: 'Dependency Check'

but in the output log I see:

Dependency Check completed with exit code 0.
Dependency Check reports:
[ 'D:\\a\\1\\TestResults\\dependency-check\\dependency-check-report.html' ]
##[debug]Attachments:
##[debug]Attachment name: dependency-check-report%2Ehtml
##[debug]Attachment path: D:\a\1\TestResults\dependency-check\dependency-check-report.html
##[debug]Attachment type: .html
Ending Dependency Check...
Async Command Start: Upload Artifact
Uploading 1 files
File upload succeed.
Upload 'D:\a\1\TestResults\dependency-check\dependency-check-report.html' to file container: '#/5768340/dependency-check'
fxboga-syfadis commented 3 years ago

OK, I think I've found the bug. I dont't know why (quote hell ?) but when you specify a path exclusion, the generated command line ends immediately and the next parameters are ignored like --format . Lets see : C:\windows\system32\cmd.exe /D /S /C "D:\a\_tasks\dependency-check-build-task_47ea1f4a-57ba-414a-b12e-c44f42765e72\6.0.2\dependency-check\bin\dependency-check.bat --project "MyProject" --scan D:\a\1\s\**\*.csproj --out D:\a\1\TestResults\dependency-check --exclude "D:\a\1\s\Dev\Tests"" --format HTML --format JSON --format JUNIT"" When I remove the exclude parameter it works.

fxboga-syfadis commented 3 years ago

Not an issue but an exclude format misunderdtanding