Started implementing the build-timeout test until I hit a roadblock with the plugin itself :(

This commit is contained in:
R. Tyler Croy 2012-07-30 06:34:51 -07:00
parent bcdd211bba
commit 33770dda9c
3 changed files with 18 additions and 51 deletions

View File

@ -4,13 +4,15 @@ Feature: Fail builds that take too long
I want to set timeouts with the build-timeout plugin to abort or
fail builds that exceed specied timeout values
@wip @realupdatecenter
Scenario: Fail a blocked job
Given I have installed the "build-timeout" plugin
And a job
When I configure the job
And I add a script build step to run "sleep 20"
And I set the build timeout to 5 seconds
When I run the job
Then the build should fail
# NOTE: The build-timeout plugin doesn't allow timeouts less than 3 minutes
# in duration, so I'm just going to leave this commented out :(
#@wip @realupdatecenter
#Scenario: Fail a blocked job
# Given I have installed the "build-timeout" plugin
# And a job
# When I configure the job
# And I add a script build step to run "sleep 10000"
# And I set the build timeout to 3 minutes
# When I run the job
# Then the build should fail

View File

@ -1,4 +1,9 @@
When /^I set the build timeout to (\d+) seconds$/ do |timeout|
pending # express the regexp above with the code you wish you had
When /^I set the build timeout to (\d+) minutes$/ do |timeout|
# Check the [x] Abort the build if it's stuck
find((:xpath, "//input[@name='hudson-plugins-build_timeout-BuildTimeoutWrapper']").set(true)
choose 'build-timeout.timeoutType'
fill_in '_.timeoutMunites', :with => timeout
end

View File

@ -1,40 +0,0 @@
require File.dirname(__FILE__) + "/../lib/base"
require File.dirname(__FILE__) + "/../pageobjects/newjob"
require File.dirname(__FILE__) + "/../pageobjects/job"
require File.dirname(__FILE__) + "/../pageobjects/pluginmanager"
class BuildTimeoutPluginTests < JenkinsSeleniumTest
def setup
super
PluginManager.new(@driver, @base_url).install_plugin('build-timeout')
restart_jenkins
@job_name = "Selenium_Timeout_Test_Job"
NewJob.create_freestyle(@driver, @base_url, @job_name)
@job = Job.new(@driver, @base_url, @job_name)
end
def test_git_clone
@job.configure do
timeout_box = @driver.find_element(:xpath, "//input[@name='hudson-plugins-build_timeout-BuildTimeoutWrapper']")
timeout_box.click
timeout_value = @driver.find_element(:xpath, "//input[@name='build-timeout.timeoutMinutes']")
timeout_value.send_keys "1"
failBuild = @driver.find_element(:xpath, "//input[@name='build-timeout.failBuild']")
failBuild.click
@job.add_build_step "sleep 120"
end
@job.queue_build
sleep 60
build = @job.build(1)
assert build.failed?, "The build should have failed!"
end
end