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:
parent
fedd76678b
commit
3fe4a3d214
@ -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):
|
||||
|
10
tests/publishers/fixtures/junit001.xml
Normal file
10
tests/publishers/fixtures/junit001.xml
Normal 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>
|
3
tests/publishers/fixtures/junit001.yaml
Normal file
3
tests/publishers/fixtures/junit001.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
publishers:
|
||||
- junit:
|
||||
results: nosetests.xml
|
12
tests/publishers/fixtures/junit002.xml
Normal file
12
tests/publishers/fixtures/junit002.xml
Normal 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>
|
5
tests/publishers/fixtures/junit002.yaml
Normal file
5
tests/publishers/fixtures/junit002.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
publishers:
|
||||
- junit:
|
||||
results: nosetests-example.xml
|
||||
keep-long-stdio: false
|
||||
test-stability: true
|
Loading…
x
Reference in New Issue
Block a user