publishers: xunit doesn't accepts integers as threshold
* Accept integers for threshold In documentation is written that threshold should be integer. But it fails with integer to generate XML. Only case when it pass is for 0, because XML formatter consider it as empty body and do not format it. * Fix documentation for missing threshold field, plus test. In documentation it says that missing threshold is set to 0, but apparently it is set to Null (empty field), and it has different behaviour than for 0 value. Change-Id: I326cbadd955c4c28f315fa72293d9a54a116b140
This commit is contained in:
parent
78411048f6
commit
1cf55db557
@ -1103,7 +1103,7 @@ def xunit(parser, xml_parent, data):
|
||||
# Normalize and craft the element name for this threshold
|
||||
elname = "%sThreshold" % threshold_name.lower().replace(
|
||||
'new', 'New')
|
||||
XML.SubElement(el, elname).text = threshold_value
|
||||
XML.SubElement(el, elname).text = str(threshold_value)
|
||||
|
||||
# Whether to use percent of exact number of tests.
|
||||
# Thresholdmode is either:
|
||||
|
@ -27,16 +27,16 @@
|
||||
</types>
|
||||
<thresholds>
|
||||
<org.jenkinsci.plugins.xunit.threshold.FailedThreshold>
|
||||
<unstableThreshold/>
|
||||
<unstableNewThreshold/>
|
||||
<failureThreshold/>
|
||||
<failureNewThreshold/>
|
||||
<unstableThreshold>0</unstableThreshold>
|
||||
<unstableNewThreshold>0</unstableNewThreshold>
|
||||
<failureThreshold>0</failureThreshold>
|
||||
<failureNewThreshold>0</failureNewThreshold>
|
||||
</org.jenkinsci.plugins.xunit.threshold.FailedThreshold>
|
||||
<org.jenkinsci.plugins.xunit.threshold.SkippedThreshold>
|
||||
<unstableThreshold/>
|
||||
<unstableNewThreshold/>
|
||||
<failureThreshold/>
|
||||
<failureNewThreshold/>
|
||||
<unstableThreshold>0</unstableThreshold>
|
||||
<unstableNewThreshold>0</unstableNewThreshold>
|
||||
<failureThreshold>0</failureThreshold>
|
||||
<failureNewThreshold>0</failureNewThreshold>
|
||||
</org.jenkinsci.plugins.xunit.threshold.SkippedThreshold>
|
||||
</thresholds>
|
||||
<thresholdMode>2</thresholdMode>
|
||||
|
@ -4,15 +4,15 @@ publishers:
|
||||
thresholdmode: 'number'
|
||||
thresholds:
|
||||
- failed:
|
||||
unstable: '1'
|
||||
unstablenew: '2'
|
||||
failure: '3'
|
||||
failurenew: '4'
|
||||
unstable: 1
|
||||
unstablenew: 2
|
||||
failure: 3
|
||||
failurenew: 4
|
||||
- skipped:
|
||||
unstable: '5'
|
||||
unstablenew: '6'
|
||||
failure: '7'
|
||||
failurenew: '8'
|
||||
unstable: 5
|
||||
unstablenew: 6
|
||||
failure: 7
|
||||
failurenew: 8
|
||||
types:
|
||||
- ctest:
|
||||
pattern: "build/tests/reports/ctest.xml"
|
||||
|
30
tests/publishers/fixtures/xunit003.xml
Normal file
30
tests/publishers/fixtures/xunit003.xml
Normal file
@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<publishers>
|
||||
<xunit>
|
||||
<types>
|
||||
<PHPUnitJunitHudsonTestType>
|
||||
<pattern>junit.log</pattern>
|
||||
<failIfNotNew>true</failIfNotNew>
|
||||
<deleteOutputFiles>true</deleteOutputFiles>
|
||||
<skipNoTestFiles>false</skipNoTestFiles>
|
||||
<stopProcessingIfError>true</stopProcessingIfError>
|
||||
</PHPUnitJunitHudsonTestType>
|
||||
</types>
|
||||
<thresholds>
|
||||
<org.jenkinsci.plugins.xunit.threshold.FailedThreshold>
|
||||
<unstableThreshold>10</unstableThreshold>
|
||||
<failureThreshold>5</failureThreshold>
|
||||
</org.jenkinsci.plugins.xunit.threshold.FailedThreshold>
|
||||
<org.jenkinsci.plugins.xunit.threshold.SkippedThreshold>
|
||||
<unstableNewThreshold>5</unstableNewThreshold>
|
||||
<failureNewThreshold>10</failureNewThreshold>
|
||||
</org.jenkinsci.plugins.xunit.threshold.SkippedThreshold>
|
||||
</thresholds>
|
||||
<thresholdMode>1</thresholdMode>
|
||||
<extraConfiguration>
|
||||
<testTimeMargin>3000</testTimeMargin>
|
||||
</extraConfiguration>
|
||||
</xunit>
|
||||
</publishers>
|
||||
</project>
|
12
tests/publishers/fixtures/xunit003.yaml
Normal file
12
tests/publishers/fixtures/xunit003.yaml
Normal file
@ -0,0 +1,12 @@
|
||||
publishers:
|
||||
- xunit:
|
||||
thresholds:
|
||||
- failed:
|
||||
unstable: 10
|
||||
failure: 5
|
||||
- skipped:
|
||||
unstablenew: 5
|
||||
failurenew: 10
|
||||
types:
|
||||
- phpunit:
|
||||
pattern: "junit.log"
|
Loading…
Reference in New Issue
Block a user