Add support for cucumber reports plugin

This plugin creates pretty cucumber-jvm html reports on jenkins

Change-Id: Ia9673a8d290bd37bd38a7c3ab3545c751128f4c2
story: 2000226
This commit is contained in:
Dong Ma 2015-12-01 01:31:27 +08:00
parent c62b0a10d0
commit c3c51845ad
6 changed files with 122 additions and 0 deletions

View File

@ -977,6 +977,75 @@ def junit(parser, xml_parent, data):
'hudson.plugins.measurement__plots.TestDataPublisher')
def cucumber_reports(parser, xml_parent, data):
"""yaml: cucumber-reports
This plugin creates pretty cucumber-jvm html reports on jenkins.
Requires the Jenkins :jenkins-wiki:`cucumber reports
<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 '')
:arg str plugin-url-path: The path to the jenkins user content url
e.g. 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:
.. literalinclude::
/../../tests/publishers/fixtures/cucumber_reports001.yaml
:language: yaml
.. literalinclude::
/../../tests/publishers/fixtures/cucumber_reports002.yaml
:language: yaml
"""
cucumber_reports = XML.SubElement(xml_parent,
'net.masterthought.jenkins.'
'CucumberReportPublisher')
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()
def cucumber_testresult(parser, xml_parent, data):
"""yaml: cucumber-testresult
Publish cucumber test results.

View File

@ -164,6 +164,7 @@ jenkins_jobs.publishers =
copy-to-master=jenkins_jobs.modules.publishers:copy_to_master
coverage=jenkins_jobs.modules.publishers:coverage
cppcheck=jenkins_jobs.modules.publishers:cppcheck
cucumber-reports=jenkins_jobs.modules.publishers:cucumber_reports
cucumber-testresult=jenkins_jobs.modules.publishers:cucumber_testresult
description-setter=jenkins_jobs.modules.publishers:description_setter
disable-failed-job=jenkins_jobs.modules.publishers:disable_failed_job

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<net.masterthought.jenkins.CucumberReportPublisher>
<jsonReportDirectory/>
<pluginUrlPath>http://example.com/</pluginUrlPath>
<fileIncludePattern/>
<fileExcludePattern/>
<skippedFails>false</skippedFails>
<pendingFails>false</pendingFails>
<undefinedFails>false</undefinedFails>
<missingFails>false</missingFails>
<noFlashCharts>false</noFlashCharts>
<ignoreFailedTests>false</ignoreFailedTests>
<parallelTesting>false</parallelTesting>
</net.masterthought.jenkins.CucumberReportPublisher>
</publishers>
</project>

View File

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

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<net.masterthought.jenkins.CucumberReportPublisher>
<jsonReportDirectory>path</jsonReportDirectory>
<pluginUrlPath>http://example.com/</pluginUrlPath>
<fileIncludePattern>**/*.json</fileIncludePattern>
<fileExcludePattern>badfile.txt</fileExcludePattern>
<skippedFails>true</skippedFails>
<pendingFails>true</pendingFails>
<undefinedFails>true</undefinedFails>
<missingFails>true</missingFails>
<noFlashCharts>true</noFlashCharts>
<ignoreFailedTests>true</ignoreFailedTests>
<parallelTesting>true</parallelTesting>
</net.masterthought.jenkins.CucumberReportPublisher>
</publishers>
</project>

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