Update junit plugin

- update junit plugin to use convert xml
- update docstring of junit plugin

Change-Id: I47e5ebd159bca869a297cf5f0b85a3d63bb264ac
This commit is contained in:
Dong Ma 2016-09-13 11:21:03 +08:00
parent 23cbeda2e9
commit a463b12f29
3 changed files with 15 additions and 17 deletions

View File

@ -1066,14 +1066,14 @@ def junit(registry, xml_parent, data):
"""yaml: junit
Publish JUnit test results.
:arg str results: results filename
:arg str results: results filename (required)
:arg bool keep-long-stdio: Retain long standard output/error in test
results (default true).
:arg bool allow-empty-results: Do not fail builds if no junit reports
are found (default false)
:arg float health-scale-factor: Amplification factor to apply to test
failures when computing the test result contribution to the build health
score. (default 1.0)
failures when computing the test result contribution to the build
health score. (default 1.0)
:arg bool allow-empty-results: Do not fail the build if the JUnit files are
missing (default false).
:arg bool test-stability: Add historical information about test
@ -1102,15 +1102,15 @@ def junit(registry, xml_parent, data):
junitresult = XML.SubElement(xml_parent,
'hudson.tasks.junit.JUnitResultArchiver')
junitresult.set('plugin', 'junit')
XML.SubElement(junitresult, 'testResults').text = data['results']
XML.SubElement(junitresult, 'keepLongStdio').text = str(
data.get('keep-long-stdio', True)).lower()
XML.SubElement(junitresult, 'allowEmptyResults').text = str(
data.get('allow-empty-results', False)).lower()
XML.SubElement(junitresult, 'healthScaleFactor').text = str(
data.get('health-scale-factor', '1.0'))
XML.SubElement(junitresult, 'allowEmptyResults').text = str(
data.get('allow-empty-results', False)).lower()
mapping = [
('results', 'testResults', None),
('keep-long-stdio', 'keepLongStdio', True),
('health-scale-factor', 'healthScaleFactor', '1.0'),
('allow-empty-results', 'allowEmptyResults', False),
]
helpers.convert_mapping_to_xml(
junitresult, data, mapping, fail_required=True)
datapublisher = XML.SubElement(junitresult, 'testDataPublishers')
if str(data.get('test-stability', False)).lower() == 'true':
XML.SubElement(datapublisher,

View File

@ -4,7 +4,6 @@
<hudson.tasks.junit.JUnitResultArchiver plugin="junit">
<testResults>nosetests.xml</testResults>
<keepLongStdio>true</keepLongStdio>
<allowEmptyResults>false</allowEmptyResults>
<healthScaleFactor>1.0</healthScaleFactor>
<allowEmptyResults>false</allowEmptyResults>
<testDataPublishers/>

View File

@ -4,7 +4,6 @@
<hudson.tasks.junit.JUnitResultArchiver plugin="junit">
<testResults>nosetests-example.xml</testResults>
<keepLongStdio>false</keepLongStdio>
<allowEmptyResults>true</allowEmptyResults>
<healthScaleFactor>2.0</healthScaleFactor>
<allowEmptyResults>true</allowEmptyResults>
<testDataPublishers>