Complete the code to publish HTML reports in Jenkins pipeline.
publishHTML(target: [allowMissing: false, alwaysLinkToLastBuild: true, keepAll: true, reportDir: 'reports', reportFiles: '[1]', reportName: 'Test Report'])
The reportFiles parameter should point to the main HTML file, usually index.html, to publish the report correctly.
Complete the code to specify the directory containing the HTML reports.
publishHTML(target: [reportDir: '[1]', reportFiles: 'index.html', reportName: 'Coverage Report'])
The reportDir should point to the folder where the HTML reports are generated, commonly named coverage for coverage reports.
Fix the error in the Jenkins pipeline snippet to correctly publish HTML reports.
publishHTML(target: [allowMissing: false, alwaysLinkToLastBuild: true, keepAll: true, reportDir: 'test-results', reportFiles: '[1]', reportName: 'Test Results'])
The reportFiles must be an HTML file, typically index.html. Using a non-HTML or incorrectly named file causes the report not to display.
Fill both blanks to configure Jenkins to keep all reports and link to the last build.
publishHTML(target: [keepAll: [1], alwaysLinkToLastBuild: [2], reportDir: 'output', reportFiles: 'index.html', reportName: 'Build Report'])
Both keepAll and alwaysLinkToLastBuild expect boolean values. Setting them to true ensures all reports are kept and the last build is linked.
Fill all three blanks to create a Jenkins pipeline snippet that publishes HTML reports with custom report directory, file, and name.
publishHTML(target: [reportDir: '[1]', reportFiles: '[2]', reportName: '[3]'])
The reportDir is set to test-results, the reportFiles to index.html, and the reportName to a descriptive name like Functional Tests.