Skip to content
Permalink
Browse files

[FIXED JENKINS-31887] Added support for Selenium Report plugin

Added a release notes entry for Seleniumhq Plugin

Added a release notes entry for Seleniumhq Plugin
  • Loading branch information...
v1v committed Dec 3, 2015
1 parent 9ba3238 commit 02c0ab7e8c56de4217b6bf62c6cc4907bd663878
@@ -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 [Seleniumhq Plugin](https://wiki.jenkins-ci.org/display/JENKINS/Seleniumhq+Plugin)
([JENKINS-31887](https://issues.jenkins-ci.org/browse/JENKINS-31887))
* 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)
@@ -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 {
seleniumReport('myproject/target/test-reports/*.html') {
useTestCommands()
}
}
}
@@ -1846,6 +1846,22 @@ class PublisherContext extends AbstractExtensibleContext {
}
}

/**
* Publishes Selenium Reports.
*
* @since 1.42
*/
@RequiresPlugin(id = 'seleniumhq', minimumVersion = '0.4')
void seleniumReport(String testReportHtmls = null, @DslContext(SeleniumReportContext) Closure closure = null) {
SeleniumReportContext context = new SeleniumReportContext()
ContextHelper.executeInContext(closure, context)

publisherNodes << new NodeBuilder().'hudson.plugins.seleniumhq.SeleniumhqPublisher' {
delegate.testResults(testReportHtmls ?: '')
useTestCommands(context.useTestCommands)
}
}

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

import javaposse.jobdsl.dsl.Context

class SeleniumReportContext implements Context {
boolean useTestCommands = false

/**
* If set, Use status of test commands instead of suites to determine UNSTABLE/FAILURE/SUCCESS.
* Defaults to {@code false}.
*/
void useTestCommands(boolean useTestCommands = true) {
this.useTestCommands = useTestCommands
}
}
@@ -5665,4 +5665,39 @@ class PublisherContextSpec extends Specification {
}
1 * jobManagement.requireMinimumPluginVersion('rubyMetrics', '1.6.3')
}

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

then:
context.publisherNodes.size() == 1
with(context.publisherNodes[0]) {
name() == 'hudson.plugins.seleniumhq.SeleniumhqPublisher'
children().size() == 2
testResults[0].value().empty
useTestCommands[0].value() == false
}
1 * jobManagement.requireMinimumPluginVersion('seleniumhq', '0.4')
}

def 'call seleniumReport with all options'() {
when:
context.seleniumReport('./selenium*') {
useTestCommands(value)
}

then:
context.publisherNodes.size() == 1
with(context.publisherNodes[0]) {
name() == 'hudson.plugins.seleniumhq.SeleniumhqPublisher'
children().size() == 2
testResults[0].value() == './selenium*'
useTestCommands[0].value() == value
}
1 * jobManagement.requireMinimumPluginVersion('seleniumhq', '0.4')

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

0 comments on commit 02c0ab7

Please sign in to comment.
You can’t perform that action at this time.