test if sites are online
// if the title can change, test can validate occurance of a phrase instead
1 2 require 'rwebunit' # ruby web test based on watir (uses ie=internet-explorer-object) 3 4 # test if sites are online by title validation 5 # usage: to run this test without visible ie use the -b option 6 # C:\ruby\workspace\ruject1>ruby rwu_site_checker.rb -b 7 8 class RwuSiteChecker < RWebUnit::WebTestCase 9 10 # hash with url and title 11 @@sites = { 12 "http://www.domain_number_one.de" => "title number one", 13 "http://www.seccond_domain.org" => "seccond title", 14 "http://www.yet_another_domain.com" => "yet another title" 15 } 16 17 # test for titles 18 def test_titles() 19 log = "testing title \n" 20 @@sites.each { |url, title| 21 getTestContext().base_url=url 22 beginAt("/") 23 assertTitleEquals(title) 24 # to check for phrase: assertTextPresent(phrase) 25 26 log += url + " ok \n" 27 } 28 puts log 29 end 30 31 end 32