Update cucumber-testresult plugin

- update cucumber-testresult plugin to use convert xml
- add plugin="cucumber-testresult-plugin" attribute
- add new parameter 'ignore-bad-steps' support
- update test cases

Change-Id: I8ef353fea030dc0aab0cf9f006fdc84c72834ee7
This commit is contained in:
Dong Ma 2016-09-14 12:46:16 +08:00
parent a463b12f29
commit bff19ac90b
5 changed files with 33 additions and 9 deletions

View File

@ -1198,23 +1198,33 @@ def cucumber_testresult(registry, xml_parent, data):
Requires the Jenkins :jenkins-wiki:`cucumber testresult
<Cucumber+Test+Result+Plugin>`.
:arg str results: results filename (required)
:arg str results: Results filename (required)
:arg bool ignore-bad-steps: Ignore not existed step results (default false)
Example:
Minimal example:
.. literalinclude::
/../../tests/publishers/fixtures/cucumber_testresult.yaml
:language: yaml
/../../tests/publishers/fixtures/cucumber-testresult-minimal.yaml
:language: yaml
Full Example:
.. literalinclude::
/../../tests/publishers/fixtures/cucumber-testresult-complete.yaml
:language: yaml
"""
cucumber_result = XML.SubElement(xml_parent,
'org.jenkinsci.plugins.cucumber.'
'jsontestsupport.'
'CucumberTestResultArchiver')
filepath = data.get('results', None)
if filepath is None:
raise MissingAttributeError('results')
XML.SubElement(cucumber_result, 'testResults').text = str(filepath)
cucumber_result.set('plugin', 'cucumber-testresult-plugin')
mappings = [
('results', 'testResults', None),
('ignore-bad-steps', 'ignoreBadSteps', False)
]
helpers.convert_mapping_to_xml(
cucumber_result, data, mappings, fail_required=True)
def xunit(registry, xml_parent, data):

View File

@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<org.jenkinsci.plugins.cucumber.jsontestsupport.CucumberTestResultArchiver>
<org.jenkinsci.plugins.cucumber.jsontestsupport.CucumberTestResultArchiver plugin="cucumber-testresult-plugin">
<testResults>nosetests.xml</testResults>
<ignoreBadSteps>true</ignoreBadSteps>
</org.jenkinsci.plugins.cucumber.jsontestsupport.CucumberTestResultArchiver>
</publishers>
</project>

View File

@ -0,0 +1,4 @@
publishers:
- cucumber-testresult:
results: nosetests.xml
ignore-bad-steps: true

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<org.jenkinsci.plugins.cucumber.jsontestsupport.CucumberTestResultArchiver plugin="cucumber-testresult-plugin">
<testResults>nosetests.xml</testResults>
<ignoreBadSteps>false</ignoreBadSteps>
</org.jenkinsci.plugins.cucumber.jsontestsupport.CucumberTestResultArchiver>
</publishers>
</project>