Add TAP test result handling ability

Add support for using org.tap4j.plugin.TapPublisher as a publisher "tap"

See https://wiki.jenkins-ci.org/display/JENKINS/TAP+Plugin for the
plugin in question

Change-Id: Iddbd96715830ecc761384963fecfe3cd5ec3c115
Reviewed-on: https://review.openstack.org/34974
Reviewed-by: Khai Do <zaro0508@gmail.com>
Reviewed-by: James E. Blair <corvus@inaugust.com>
Approved: Clark Boylan <clark.boylan@gmail.com>
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Tested-by: Jenkins
This commit is contained in:
Carl Fürstenberg 2013-06-29 04:31:50 +02:00 committed by Jenkins
parent bf4524fae2
commit 624fd659cc
2 changed files with 49 additions and 0 deletions

View File

@ -1759,6 +1759,54 @@ def maven_deploy(parser, xml_parent, data):
data.get('deploy-unstable', 'false')).lower()
def tap(parser, xml_parent, data):
"""yaml: tap
Adds support to TAP test result files
See `TAP Plugin.
<https://wiki.jenkins-ci.org/display/JENKINS/TAP+Plugin>`_
:arg str results: TAP test result files
:arg bool fail-if-no-results: Fail if no result (default False)
:arg bool failed-tests-mark-build-as-failure:
Mark build as failure if test fails (default False)
:arg bool output-tap-to-console: Output tap to console (default True)
:arg bool enable-subtests: Enable subtests (Default True)
:arg bool discard-old-reports: Discard old reports (Default False)
:arg bool todo-is-failure: Handle TODO's as failures (Default True)
Example::
publishers:
- tap:
results: puiparts.tap
todo-is-failure: false
"""
tap = XML.SubElement(xml_parent, 'org.tap4j.plugin.TapPublisher')
XML.SubElement(tap, 'testResults').text = data['results']
XML.SubElement(tap, 'failIfNoResults').text = str(
data.get('fail-if-no-results', False)).lower()
XML.SubElement(tap, 'failedTestsMarkBuildAsFailure').text = str(
data.get('failed-tests-mark-build-as-failure', False)).lower()
XML.SubElement(tap, 'outputTapToConsole').text = str(
data.get('output-tap-to-console', True)).lower()
XML.SubElement(tap, 'enableSubtests').text = str(
data.get('enable-subtests', True)).lower()
XML.SubElement(tap, 'discardOldReports').text = str(
data.get('discard-old-reports', False)).lower()
XML.SubElement(tap, 'todoIsFailure').text = str(
data.get('todo-is-failure', True)).lower()
class Publishers(jenkins_jobs.modules.base.Base):
sequence = 70

View File

@ -133,6 +133,7 @@ setuptools.setup(
'workspace-cleanup=jenkins_jobs.modules.publishers:'
'workspace_cleanup',
'maven-deploy=jenkins_jobs.modules.publishers:maven_deploy',
'tap=jenkins_jobs.modules.publishers:tap',
],
'jenkins_jobs.scm': [
'git=jenkins_jobs.modules.scm:git',