<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: rwebunit code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Thu, 24 Jul 2008 19:09:28 GMT</pubDate>
    <description>DZone Snippets: rwebunit code</description>
    <item>
      <title>test if sites are online</title>
      <link>http://snippets.dzone.com/posts/show/2465</link>
      <description>// test if sites are online by title validation&lt;br /&gt;// if the title can change, test can validate occurance of a phrase instead&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;require 'rwebunit'  # ruby web test based on watir (uses ie=internet-explorer-object)&lt;br /&gt;&lt;br /&gt;# test if sites are online by title validation&lt;br /&gt;# usage: to run this test without visible ie use the -b option&lt;br /&gt;# C:\ruby\workspace\ruject1&gt;ruby rwu_site_checker.rb -b&lt;br /&gt;&lt;br /&gt;class RwuSiteChecker &lt; RWebUnit::WebTestCase&lt;br /&gt;&lt;br /&gt;  # hash with url and title&lt;br /&gt;  @@sites = {&lt;br /&gt;    "http://www.domain_number_one.de" =&gt; "title number one",&lt;br /&gt;    "http://www.seccond_domain.org" =&gt; "seccond title",&lt;br /&gt;    "http://www.yet_another_domain.com" =&gt; "yet another title"&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  # test for titles&lt;br /&gt;  def test_titles()&lt;br /&gt;    log = "testing title \n"&lt;br /&gt;    @@sites.each { |url, title|&lt;br /&gt;      getTestContext().base_url=url&lt;br /&gt;      beginAt("/")&lt;br /&gt;      assertTitleEquals(title)&lt;br /&gt;      # to check for phrase: assertTextPresent(phrase) &lt;br /&gt;   &lt;br /&gt;      log += url + " ok \n"&lt;br /&gt;    }&lt;br /&gt;    puts log&lt;br /&gt;  end&lt;br /&gt;  &lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Fri, 25 Aug 2006 00:24:19 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2465</guid>
      <author>ovhaag (Oliver Haag)</author>
    </item>
  </channel>
</rss>
