Generate Html report using junit xml report

Hello Community,

I am trying to generate HTML report using the xml report . But in the dashboard I just see the Report name but there is no content . Here I am attaching the snippet of my pipeline script. Any leads is appreciated.

sh ‘/var/lib/jenkins/.local/bin/pytest --junitxml=pytest-result.xml’
publishHTML([allowMissing: false, alwaysLinkToLastBuild: true, keepAll: true, reportDir: ‘/var/lib/jenkins/workspace/Testcases’, reportFiles: ‘pytest-result.xml’, reportName: ‘Pytest Test Report’, reportTitles: ‘’])

you say html, but it feels like your trying to publish XML files. is that intentional?

why the hard coded path? most plugins have trouble escaping the workspace, and this directory doesn’t actually match a job’s workspace. You could probably drop this parameter or use $WORKSPACE instead

I want the .xml report to be published as HTML report , since there is no snippet generator like PublishXML . I tried to use PublishHTML and inside this pass the .xml file. And coming to
reportDir: ‘/var/lib/jenkins/workspace/Testcases’ , This is the path of my workspace( I will check with $WORKSPACE)

What does publishing XML as html mean? Do you want to archive your XML as an artifact? Html has specific format and XML isn’t it.

I recommend just archiveArtifact()

Okie, Let me put in this way I need the xml report that will be saved in Workspace to be shown in Dashboard with some title like Report .