Update Cucumber Reports plugin

- Update to use convert_mapping_to_xml
- Update documentation to standard convention

Change-Id: I5c124bfba2f5290d2ce45551a60c0adbbcc2125d
Signed-off-by: Kien Ha <kienha9922@gmail.com>
This commit is contained in:
Kien Ha 2016-05-25 20:30:27 -04:00
parent 49be71864a
commit 789ba36d49
7 changed files with 59 additions and 65 deletions

View File

@ -1091,65 +1091,60 @@ def cucumber_reports(parser, xml_parent, data):
<Cucumber+Reports+Plugin>`.
:arg str json-reports-path: The path relative to the workspace of
the json reports generated by cucumber-jvm e.g. target - leave
empty to scan the whole workspace (default '')
:arg str file-include-pattern: include pattern (default '')
:arg str file-exclude-pattern: exclude pattern (default '')
the json reports generated by cucumber-jvm e.g. target - leave
empty to scan the whole workspace (default '')
:arg str file-include-pattern: Include pattern (default '')
:arg str file-exclude-pattern: Exclude pattern (default '')
:arg str plugin-url-path: The path to the jenkins user content url
e.g. :samp:`http://host:port[/jenkins/]plugin` - leave empty if jenkins
url root is host:port (default '')
:arg bool skipped-fails: skipped steps to cause the build to fail
(default false)
:arg bool pending-fails: pending steps to cause the build to fail
(default false)
:arg bool undefined-fails: undefined steps to cause the build to fail
(default false)
:arg bool missing-fails: missing steps to cause the build to fail
(default false)
:arg bool no-flash-charts: use javascript charts instead of flash charts
(default false)
:arg bool ignore-failed-tests: entire build to fail when these tests fail
(default false)
:arg bool parallel-testing: run same test in parallel for multiple devices
(default false)
e.g. :samp:`http://host:port[/jenkins/]plugin` - leave empty if jenkins
url root is host:port (default '')
:arg bool skipped-fails: Skipped steps to cause the build to fail
(default false)
:arg bool pending-fails: Pending steps to cause the build to fail
(default false)
:arg bool undefined-fails: Undefined steps to cause the build to fail
(default false)
:arg bool missing-fails: Missing steps to cause the build to fail
(default false)
:arg bool no-flash-charts: Use javascript charts instead of flash charts
(default false)
:arg bool ignore-failed-tests: Entire build to fail when these tests fail
(default false)
:arg bool parallel-testing: Run same test in parallel for multiple devices
(default false)
Example:
Full example:
.. literalinclude::
/../../tests/publishers/fixtures/cucumber_reports001.yaml
/../../tests/publishers/fixtures/cucumber-reports-complete.yaml
:language: yaml
Minimal Example:
.. literalinclude::
/../../tests/publishers/fixtures/cucumber_reports002.yaml
/../../tests/publishers/fixtures/cucumber-reports-minimal.yaml
:language: yaml
"""
cucumber_reports = XML.SubElement(xml_parent,
'net.masterthought.jenkins.'
'CucumberReportPublisher')
cucumber_reports.set('plugin', 'cucumber-reports')
XML.SubElement(cucumber_reports, 'jsonReportDirectory').text = str(
data.get('json-reports-path', ''))
XML.SubElement(cucumber_reports, 'pluginUrlPath').text = str(
data.get('plugin-url-path', ''))
XML.SubElement(cucumber_reports, 'fileIncludePattern').text = str(
data.get('file-include-pattern', ''))
XML.SubElement(cucumber_reports, 'fileExcludePattern').text = str(
data.get('file-exclude-pattern', ''))
XML.SubElement(cucumber_reports, 'skippedFails').text = str(
data.get('skipped-fails', False)).lower()
XML.SubElement(cucumber_reports, 'pendingFails').text = str(
data.get('pending-fails', False)).lower()
XML.SubElement(cucumber_reports, 'undefinedFails').text = str(
data.get('undefined-fails', False)).lower()
XML.SubElement(cucumber_reports, 'missingFails').text = str(
data.get('missing-fails', False)).lower()
XML.SubElement(cucumber_reports, 'noFlashCharts').text = str(
data.get('no-flash-charts', False)).lower()
XML.SubElement(cucumber_reports, 'ignoreFailedTests').text = str(
data.get('ignore-failed-tests', False)).lower()
XML.SubElement(cucumber_reports, 'parallelTesting').text = str(
data.get('parallel-testing', False)).lower()
mappings = [
('json-reports-path', 'jsonReportDirectory', ''),
('plugin-url-path', 'pluginUrlPath', ''),
('file-include-pattern', 'fileIncludePattern', ''),
('file-exclude-pattern', 'fileExcludePattern', ''),
('skipped-fails', 'skippedFails', False),
('pending-fails', 'pendingFails', False),
('undefined-fails', 'undefinedFails', False),
('missing-fails', 'missingFails', False),
('no-flash-charts', 'noFlashCharts', False),
('ignore-failed-tests', 'ignoreFailedTests', False),
('parallel-testing', 'parallelTesting', False)
]
helpers.convert_mapping_to_xml(
cucumber_reports, data, mappings, fail_required=True)
def cucumber_testresult(parser, xml_parent, data):

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<net.masterthought.jenkins.CucumberReportPublisher>
<net.masterthought.jenkins.CucumberReportPublisher plugin="cucumber-reports">
<jsonReportDirectory>path</jsonReportDirectory>
<pluginUrlPath>http://example.com/</pluginUrlPath>
<fileIncludePattern>**/*.json</fileIncludePattern>

View File

@ -0,0 +1,13 @@
publishers:
- cucumber-reports:
json-reports-path: path
plugin-url-path: http://example.com/
file-include-pattern: '**/*.json'
file-exclude-pattern: badfile.txt
skipped-fails: true
pending-fails: true
undefined-fails: true
missing-fails: true
no-flash-charts: true
ignore-failed-tests: true
parallel-testing: true

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<net.masterthought.jenkins.CucumberReportPublisher>
<net.masterthought.jenkins.CucumberReportPublisher plugin="cucumber-reports">
<jsonReportDirectory/>
<pluginUrlPath>http://example.com/</pluginUrlPath>
<pluginUrlPath/>
<fileIncludePattern/>
<fileExcludePattern/>
<skippedFails>false</skippedFails>

View File

@ -0,0 +1,2 @@
publishers:
- cucumber-reports

View File

@ -1,3 +0,0 @@
publishers:
- cucumber-reports:
plugin-url-path: http://example.com/

View File

@ -1,13 +0,0 @@
publishers:
- cucumber-reports:
json-reports-path: path
plugin-url-path: http://example.com/
file-include-pattern: '**/*.json'
file-exclude-pattern: badfile.txt
skipped-fails: true
pending-fails: true
undefined-fails: true
missing-fails: true
no-flash-charts: true
ignore-failed-tests: true
parallel-testing: true