diff --git a/jenkins_jobs/modules/publishers.py b/jenkins_jobs/modules/publishers.py index 1a583bfa2..3067327db 100644 --- a/jenkins_jobs/modules/publishers.py +++ b/jenkins_jobs/modules/publishers.py @@ -5151,9 +5151,9 @@ def scoverage(parser, xml_parent, data): Requires the Jenkins :jenkins-wiki:`Scoverage Plugin `. :arg str report-directory: This is a directory that specifies the locations - where the xml scoverage report is generated + where the xml scoverage report is generated (required) :arg str report-file: This is a file name that is given to the xml - scoverage report. + scoverage report (required) Example: @@ -5163,10 +5163,14 @@ def scoverage(parser, xml_parent, data): scoverage = XML.SubElement( xml_parent, 'org.jenkinsci.plugins.scoverage.ScoveragePublisher') - XML.SubElement(scoverage, 'reportDir').text = str( - data.get('report-directory', '')) - XML.SubElement(scoverage, 'reportFile').text = str( - data.get('report-file', '')) + scoverage.set('plugin', 'scoverage') + + mappings = [ + ('report-directory', 'reportDir', None), + ('report-file', 'reportFile', None), + ] + helpers.convert_mapping_to_xml( + scoverage, data, mappings, fail_required=True) def display_upstream_changes(parser, xml_parent, data): diff --git a/tests/publishers/fixtures/scoverage001.xml b/tests/publishers/fixtures/scoverage001.xml index 9a02f86a5..f3324669f 100644 --- a/tests/publishers/fixtures/scoverage001.xml +++ b/tests/publishers/fixtures/scoverage001.xml @@ -1,7 +1,7 @@ - + target/scala-2.10/scoverage-report/ scoverage.xml