Skip to content

Commit

Permalink
[FIXED JENKINS-31887] Added support for Selenium Report plugin
Browse files Browse the repository at this point in the history
Added a release notes entry for Seleniumhq Plugin

Added a release notes entry for Seleniumhq Plugin
  • Loading branch information
v1v committed Dec 17, 2015
1 parent 9ba3238 commit 02c0ab7
Show file tree
Hide file tree
Showing 5 changed files with 76 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 [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)
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 {
seleniumReport('myproject/target/test-reports/*.html') {
useTestCommands()
}
}
}
Expand Up @@ -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 {
Expand Down
@@ -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
}
}
Expand Up @@ -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.