Skip to content

Commit

Permalink
Adding test coverage for build pipeline views
Browse files Browse the repository at this point in the history
  • Loading branch information
ghale committed Sep 2, 2014
1 parent 1bbc610 commit 671e79e
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,23 @@ class JenkinsViewTest extends ProjectSpec {
when:
project.jenkins.views {
test {
if (viewType) {
type viewType
}
dsl {
name "test"
}
}
}

then:
new Diff(ViewFixtures.LIST_DSL_VIEW_XML, project.jenkins.views.findByName('test').xml).similar()
new Diff(expectedXml, project.jenkins.views.findByName('test').xml).similar()

where:
viewType | expectedXml
null | ViewFixtures.LIST_DSL_VIEW_XML
'ListView' | ViewFixtures.LIST_DSL_VIEW_XML
'BuildPipelineView' | ViewFixtures.BUILD_PIPELINE_VIEW_XML
}

def "configure with dsl file generates correct xml" () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,13 @@ class ViewDSLSupportTest extends TempDirSpec {
XMLUnit.setIgnoreWhitespace(true)

expect:
support.evaluateDSL('test', null, dsl) == 'test'
new Diff(ViewFixtures.LIST_DSL_VIEW_XML, support.getConfig('test')).similar()
support.evaluateDSL('test', viewType, dsl) == 'test'
new Diff(xmlToMatch, support.getConfig('test')).similar()

where:
viewType | xmlToMatch
null | ViewFixtures.LIST_DSL_VIEW_XML
'ListView' | ViewFixtures.LIST_DSL_VIEW_XML
'BuildPipelineView' | ViewFixtures.BUILD_PIPELINE_VIEW_XML
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,22 @@ class ViewFixtures {
<columns/>
</hudson.model.ListView>
"""

protected static final String BUILD_PIPELINE_VIEW_XML = """
<au.com.centrumsystems.hudson.plugin.buildpipeline.BuildPipelineView>
<filterExecutors>false</filterExecutors>
<filterQueue>false</filterQueue>
<properties class='hudson.model.View\$PropertyList'></properties>
<noOfDisplayedBuilds>1</noOfDisplayedBuilds>
<buildViewTitle></buildViewTitle>
<consoleOutputLinkStyle>Lightbox</consoleOutputLinkStyle>
<cssUrl></cssUrl>
<triggerOnlyLatestJob>false</triggerOnlyLatestJob>
<alwaysAllowManualTrigger>false</alwaysAllowManualTrigger>
<showPipelineParameters>false</showPipelineParameters>
<showPipelineParametersInHeaders>false</showPipelineParametersInHeaders>
<refreshFrequency>3</refreshFrequency>
<showPipelineDefinitionHeader>false</showPipelineDefinitionHeader>
</au.com.centrumsystems.hudson.plugin.buildpipeline.BuildPipelineView>
"""
}

0 comments on commit 671e79e

Please sign in to comment.