Skip to content

Commit

Permalink
[JENKINS-31886] Added support for Selenium Html Report plugin
Browse files Browse the repository at this point in the history
Added a release notes for seleniumhtmlreport Plugin
  • Loading branch information
v1v committed Dec 17, 2015
1 parent 9ba3238 commit 4b0ee8a
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/Home.md
Expand Up @@ -21,6 +21,8 @@ Browse the Jenkins issue tracker to see any [open issues](https://issues.jenkins

## Release Notes
* 1.42 (unreleased)
* Added support for the [seleniumhtmlreport Plugin](https://wiki.jenkins-ci.org/display/JENKINS/seleniumhtmlreport+Plugin)
([JENKINS-31886](https://issues.jenkins-ci.org/browse/JENKINS-31886))
* Added support for the [Ruby Metrics Plugin](https://wiki.jenkins-ci.org/display/JENKINS/RubyMetrics+plugin)
([JENKINS-31830](https://issues.jenkins-ci.org/browse/JENKINS-31830))
* Added support for the [DOS Trigger Plugin](https://wiki.jenkins-ci.org/display/JENKINS/DOS+Trigger)
Expand Down Expand Up @@ -631,4 +633,4 @@ Browse the Jenkins issue tracker to see any [open issues](https://issues.jenkins
* extendedEmail(recipients, subject, content, closure) - Configure email-ext plugin
* gerrit(closure) - Configure Gerrit Trigger plugin
* 1.0
* Initial release
* Initial release
@@ -0,0 +1,7 @@
job('example') {
publishers {
seleniumHtml('target/test-output') {
failOnExceptions()
}
}
}
Expand Up @@ -1846,6 +1846,23 @@ class PublisherContext extends AbstractExtensibleContext {
}
}

/**
* Publishes Selenium Html reports.
*
* @since 1.42
*/
@RequiresPlugin(id = 'seleniumhtmlreport', minimumVersion = '1.0')
void seleniumHtml(String testResultsDir = 'target', @DslContext(SeleniumHtmlContext) Closure closure = null) {
SeleniumHtmlContext context = new SeleniumHtmlContext()
ContextHelper.executeInContext(closure, context)

publisherNodes << new NodeBuilder().'org.jvnet.hudson.plugins.seleniumhtmlreport.SeleniumHtmlReportPublisher' {
SELENIUM__REPORTS__TARGET('seleniumReports')
delegate.testResultsDir(testResultsDir ?: 'target')
failureIfExceptionOnParsingResultFiles(context.failOnExceptions)
}
}

@SuppressWarnings('NoDef')
private static addStaticAnalysisContext(def nodeBuilder, StaticAnalysisContext context) {
nodeBuilder.with {
Expand Down
@@ -0,0 +1,15 @@
package javaposse.jobdsl.dsl.helpers.publisher

import javaposse.jobdsl.dsl.Context

class SeleniumHtmlContext implements Context {
boolean failOnExceptions = true

/**
* If set, Set build result state to failure if an exception occurred while parsing result files.
* Defaults to {@code true}.
*/
void failOnExceptions(boolean failOnExceptions = true) {
this.failOnExceptions = failOnExceptions
}
}
Expand Up @@ -5665,4 +5665,41 @@ class PublisherContextSpec extends Specification {
}
1 * jobManagement.requireMinimumPluginVersion('rubyMetrics', '1.6.3')
}

def 'call seleniumHtml with no options'() {
when:
context.seleniumHtml()

then:
context.publisherNodes.size() == 1
with(context.publisherNodes[0]) {
name() == 'org.jvnet.hudson.plugins.seleniumhtmlreport.SeleniumHtmlReportPublisher'
children().size() == 3
testResultsDir[0].value() == 'target'
failureIfExceptionOnParsingResultFiles[0].value() == true
SELENIUM__REPORTS__TARGET[0].value() == 'seleniumReports'
}
1 * jobManagement.requireMinimumPluginVersion('seleniumhtmlreport', '1.0')
}

def 'call seleniumHtml with all options'() {
when:
context.seleniumHtml('./selenium') {
failOnExceptions(value)
}

then:
context.publisherNodes.size() == 1
with(context.publisherNodes[0]) {
name() == 'org.jvnet.hudson.plugins.seleniumhtmlreport.SeleniumHtmlReportPublisher'
children().size() == 3
testResultsDir[0].value() == './selenium'
failureIfExceptionOnParsingResultFiles[0].value() == value
SELENIUM__REPORTS__TARGET[0].value() == 'seleniumReports'
}
1 * jobManagement.requireMinimumPluginVersion('seleniumhtmlreport', '1.0')

where:
value << [true, false]
}
}

0 comments on commit 4b0ee8a

Please sign in to comment.