Add support for TestNG publisher.

Change-Id: I4686958440e6058fce6c02d3e2f1b88551c18176
This commit is contained in:
Joao Vale 2014-02-24 14:16:31 +00:00
parent 07fa712f50
commit d7865c5e10
4 changed files with 47 additions and 0 deletions

View File

@ -3261,6 +3261,37 @@ def sitemonitor(parser, xml_parent, data):
XML.SubElement(site, 'mUrl').text = siteurl['url']
def testng(parser, xml_parent, data):
"""yaml: testng
This plugin publishes TestNG test reports.
Requires the Jenkins `TestNG Results Plugin.
<https://wiki.jenkins-ci.org/display/JENKINS/testng-plugin>`_
:arg str pattern: filename pattern to locate the TestNG XML report files
:arg bool escape-test-description: escapes the description string
associated with the test method while displaying test method details
(Default True)
:arg bool escape-exception-msg: escapes the test method's exception
messages. (Default True)
Example::
.. literalinclude::
/../../tests/publishers/fixtures/testng001.yaml
"""
reporter = XML.SubElement(xml_parent, 'hudson.plugins.testng.Publisher')
if not data['pattern']:
raise JenkinsJobsException("A filename pattern must be specified.")
XML.SubElement(reporter, 'reportFilenamePattern').text = data['pattern']
XML.SubElement(reporter, 'escapeTestDescp').text = str(data.get(
'escape-test-description', True))
XML.SubElement(reporter, 'escapeExceptionMsg').text = str(data.get(
'escape-exception-msg', True))
class Publishers(jenkins_jobs.modules.base.Base):
sequence = 70

View File

@ -169,6 +169,7 @@ setuptools.setup(
'ssh=jenkins_jobs.modules.publishers:ssh',
'stash=jenkins_jobs.modules.publishers:stash',
'tap=jenkins_jobs.modules.publishers:tap',
'testng=jenkins_jobs.modules.publishers:testng',
'text-finder=jenkins_jobs.modules.publishers:text_finder',
'trigger=jenkins_jobs.modules.publishers:trigger',
('trigger-parameterized-builds='

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<hudson.plugins.testng.Publisher>
<reportFilenamePattern>**/target/surefire-reports/testng-results.xml</reportFilenamePattern>
<escapeTestDescp>False</escapeTestDescp>
<escapeExceptionMsg>True</escapeExceptionMsg>
</hudson.plugins.testng.Publisher>
</publishers>
</project>

View File

@ -0,0 +1,5 @@
publishers:
- testng:
pattern: "**/target/surefire-reports/testng-results.xml"
escape-test-description: false
escape-exception-msg: true