Add support for Test Stability with Junit

Adds test-stability option to junit test result
publisher, requires Test stability plugin to be installed.

https://wiki.jenkins-ci.org/display/JENKINS/Test+stability+plugin

Change-Id: Idd7ef1bdeaf9e6fd8881bab5729950dc717ce9f3
This commit is contained in:
Pavel Sedlák 2014-01-21 16:48:45 +01:00
parent fedd76678b
commit 3fe4a3d214
5 changed files with 46 additions and 6 deletions

View File

@ -677,20 +677,30 @@ def junit(parser, xml_parent, data):
:arg str results: results filename
:arg bool keep-long-stdio: Retain long standard output/error in test
results (default true).
:arg bool test-stability: Add historical information about test
results stability (default false).
Requires the Jenkins `Test stability Plugin
<https://wiki.jenkins-ci.org/display/JENKINS/Test+stability+plugin>`_.
Example::
Minimal example using defaults:
.. literalinclude:: /../../tests/publishers/fixtures/junit001.yaml
Full example:
.. literalinclude:: /../../tests/publishers/fixtures/junit002.yaml
publishers:
- junit:
results: nosetests.xml
keep-long-stdio: false
"""
junitresult = XML.SubElement(xml_parent,
'hudson.tasks.junit.JUnitResultArchiver')
XML.SubElement(junitresult, 'testResults').text = data['results']
XML.SubElement(junitresult, 'keepLongStdio').text = str(
data.get('keep-long-stdio', True)).lower()
XML.SubElement(junitresult, 'testDataPublishers')
datapublisher = XML.SubElement(junitresult, 'testDataPublishers')
if str(data.get('test-stability', False)).lower() == 'true':
XML.SubElement(datapublisher,
'de.esailors.jenkins.teststability'
'.StabilityTestDataPublisher')
def xunit(parser, xml_parent, data):

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<hudson.tasks.junit.JUnitResultArchiver>
<testResults>nosetests.xml</testResults>
<keepLongStdio>true</keepLongStdio>
<testDataPublishers/>
</hudson.tasks.junit.JUnitResultArchiver>
</publishers>
</project>

View File

@ -0,0 +1,3 @@
publishers:
- junit:
results: nosetests.xml

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<hudson.tasks.junit.JUnitResultArchiver>
<testResults>nosetests-example.xml</testResults>
<keepLongStdio>false</keepLongStdio>
<testDataPublishers>
<de.esailors.jenkins.teststability.StabilityTestDataPublisher/>
</testDataPublishers>
</hudson.tasks.junit.JUnitResultArchiver>
</publishers>
</project>

View File

@ -0,0 +1,5 @@
publishers:
- junit:
results: nosetests-example.xml
keep-long-stdio: false
test-stability: true