Tests for checkstyle publisher
Should be straightforward, the publisher checkstyle simply lacked tests. Also make use of literal include for the examples. Change-Id: I000cdee47bb0938af9f327bcaba06b87f8287739
This commit is contained in:
parent
3ddbf020e0
commit
fc776f009a
@ -1060,19 +1060,14 @@ def checkstyle(parser, xml_parent, data):
|
|||||||
:arg str defaultEncoding: encoding for parsing or showing files
|
:arg str defaultEncoding: encoding for parsing or showing files
|
||||||
(empty will use platform default)
|
(empty will use platform default)
|
||||||
|
|
||||||
Example::
|
Example:
|
||||||
|
|
||||||
|
.. literalinclude:: /../../tests/publishers/fixtures/checkstyle001.yaml
|
||||||
|
|
||||||
|
Full example:
|
||||||
|
|
||||||
|
.. literalinclude:: /../../tests/publishers/fixtures/checkstyle002.yaml
|
||||||
|
|
||||||
publishers:
|
|
||||||
- checkstyle:
|
|
||||||
pattern: '**/checkstyle-result.xml'
|
|
||||||
healthy: 0
|
|
||||||
unHealthy: 100
|
|
||||||
healthThreshold: 'high'
|
|
||||||
thresholds:
|
|
||||||
unstable:
|
|
||||||
totalHigh: 10
|
|
||||||
failed:
|
|
||||||
totalHigh: 1
|
|
||||||
"""
|
"""
|
||||||
checkstyle = XML.SubElement(xml_parent,
|
checkstyle = XML.SubElement(xml_parent,
|
||||||
'hudson.plugins.checkstyle.'
|
'hudson.plugins.checkstyle.'
|
||||||
|
29
tests/publishers/fixtures/checkstyle001.xml
Normal file
29
tests/publishers/fixtures/checkstyle001.xml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<project>
|
||||||
|
<publishers>
|
||||||
|
<hudson.plugins.checkstyle.CheckStylePublisher>
|
||||||
|
<healthy/>
|
||||||
|
<unHealthy>100</unHealthy>
|
||||||
|
<thresholdLimit>high</thresholdLimit>
|
||||||
|
<pluginName>[CHECKSTYLE] </pluginName>
|
||||||
|
<defaultEncoding/>
|
||||||
|
<canRunOnFailed>false</canRunOnFailed>
|
||||||
|
<useStableBuildAsReference>false</useStableBuildAsReference>
|
||||||
|
<useDeltaValues>false</useDeltaValues>
|
||||||
|
<thresholds>
|
||||||
|
<unstableTotalAll/>
|
||||||
|
<unstableTotalHigh>10</unstableTotalHigh>
|
||||||
|
<unstableTotalNormal/>
|
||||||
|
<unstableTotalLow/>
|
||||||
|
<failedTotalAll/>
|
||||||
|
<failedTotalHigh>1</failedTotalHigh>
|
||||||
|
<failedTotalNormal/>
|
||||||
|
<failedTotalLow/>
|
||||||
|
</thresholds>
|
||||||
|
<shouldDetectModules>false</shouldDetectModules>
|
||||||
|
<dontComputeNew>true</dontComputeNew>
|
||||||
|
<doNotResolveRelativePaths>false</doNotResolveRelativePaths>
|
||||||
|
<pattern>**/checkstyle-result.xml</pattern>
|
||||||
|
</hudson.plugins.checkstyle.CheckStylePublisher>
|
||||||
|
</publishers>
|
||||||
|
</project>
|
11
tests/publishers/fixtures/checkstyle001.yaml
Normal file
11
tests/publishers/fixtures/checkstyle001.yaml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
publishers:
|
||||||
|
- checkstyle:
|
||||||
|
pattern: '**/checkstyle-result.xml'
|
||||||
|
healthy: 0
|
||||||
|
unHealthy: 100
|
||||||
|
healthThreshold: 'high'
|
||||||
|
thresholds:
|
||||||
|
unstable:
|
||||||
|
totalHigh: 10
|
||||||
|
failed:
|
||||||
|
totalHigh: 1
|
29
tests/publishers/fixtures/checkstyle002.xml
Normal file
29
tests/publishers/fixtures/checkstyle002.xml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<project>
|
||||||
|
<publishers>
|
||||||
|
<hudson.plugins.checkstyle.CheckStylePublisher>
|
||||||
|
<healthy/>
|
||||||
|
<unHealthy>100</unHealthy>
|
||||||
|
<thresholdLimit>high</thresholdLimit>
|
||||||
|
<pluginName>[CHECKSTYLE] </pluginName>
|
||||||
|
<defaultEncoding>utf-8</defaultEncoding>
|
||||||
|
<canRunOnFailed>true</canRunOnFailed>
|
||||||
|
<useStableBuildAsReference>false</useStableBuildAsReference>
|
||||||
|
<useDeltaValues>false</useDeltaValues>
|
||||||
|
<thresholds>
|
||||||
|
<unstableTotalAll>90</unstableTotalAll>
|
||||||
|
<unstableTotalHigh>80</unstableTotalHigh>
|
||||||
|
<unstableTotalNormal>70</unstableTotalNormal>
|
||||||
|
<unstableTotalLow>60</unstableTotalLow>
|
||||||
|
<failedTotalAll>90</failedTotalAll>
|
||||||
|
<failedTotalHigh>80</failedTotalHigh>
|
||||||
|
<failedTotalNormal>70</failedTotalNormal>
|
||||||
|
<failedTotalLow>60</failedTotalLow>
|
||||||
|
</thresholds>
|
||||||
|
<shouldDetectModules>true</shouldDetectModules>
|
||||||
|
<dontComputeNew>true</dontComputeNew>
|
||||||
|
<doNotResolveRelativePaths>false</doNotResolveRelativePaths>
|
||||||
|
<pattern>**/checkstyle-result.xml</pattern>
|
||||||
|
</hudson.plugins.checkstyle.CheckStylePublisher>
|
||||||
|
</publishers>
|
||||||
|
</project>
|
20
tests/publishers/fixtures/checkstyle002.yaml
Normal file
20
tests/publishers/fixtures/checkstyle002.yaml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
publishers:
|
||||||
|
- checkstyle:
|
||||||
|
pattern: '**/checkstyle-result.xml'
|
||||||
|
canRunOnFailed: true
|
||||||
|
shouldDetectModules: true
|
||||||
|
healthy: 0
|
||||||
|
unHealthy: 100
|
||||||
|
healthThreshold: 'high'
|
||||||
|
thresholds:
|
||||||
|
unstable:
|
||||||
|
totalAll: 90
|
||||||
|
totalHigh: 80
|
||||||
|
totalNormal: 70
|
||||||
|
totalLow: 60
|
||||||
|
failed:
|
||||||
|
totalAll: 90
|
||||||
|
totalHigh: 80
|
||||||
|
totalNormal: 70
|
||||||
|
totalLow: 60
|
||||||
|
defaultEncoding: 'utf-8'
|
29
tests/publishers/fixtures/checkstyle003.xml
Normal file
29
tests/publishers/fixtures/checkstyle003.xml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<project>
|
||||||
|
<publishers>
|
||||||
|
<hudson.plugins.checkstyle.CheckStylePublisher>
|
||||||
|
<healthy/>
|
||||||
|
<unHealthy/>
|
||||||
|
<thresholdLimit>low</thresholdLimit>
|
||||||
|
<pluginName>[CHECKSTYLE] </pluginName>
|
||||||
|
<defaultEncoding/>
|
||||||
|
<canRunOnFailed>false</canRunOnFailed>
|
||||||
|
<useStableBuildAsReference>false</useStableBuildAsReference>
|
||||||
|
<useDeltaValues>false</useDeltaValues>
|
||||||
|
<thresholds>
|
||||||
|
<unstableTotalAll/>
|
||||||
|
<unstableTotalHigh/>
|
||||||
|
<unstableTotalNormal/>
|
||||||
|
<unstableTotalLow/>
|
||||||
|
<failedTotalAll/>
|
||||||
|
<failedTotalHigh/>
|
||||||
|
<failedTotalNormal/>
|
||||||
|
<failedTotalLow/>
|
||||||
|
</thresholds>
|
||||||
|
<shouldDetectModules>false</shouldDetectModules>
|
||||||
|
<dontComputeNew>true</dontComputeNew>
|
||||||
|
<doNotResolveRelativePaths>false</doNotResolveRelativePaths>
|
||||||
|
<pattern/>
|
||||||
|
</hudson.plugins.checkstyle.CheckStylePublisher>
|
||||||
|
</publishers>
|
||||||
|
</project>
|
2
tests/publishers/fixtures/checkstyle003.yaml
Normal file
2
tests/publishers/fixtures/checkstyle003.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
publishers:
|
||||||
|
- checkstyle
|
Loading…
Reference in New Issue
Block a user