<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>andthennothing.net: Selenium on Rails</title>
  <subtitle type="html">&amp;ldquo;first there was a three-legged monkey...&amp;rdquo;</subtitle>
  <id>tag:andthennothing.net,2005:Typo</id>
  <generator uri="http://typo.leetsoft.com" version="4.0">Typo</generator>
  <link href="http://andthennothing.net/xml/atom10/article/522/feed.xml" rel="self" type="application/xml+atom"/>
  <link href="http://andthennothing.net/archives/2006/02/05/selenium-on-rails" rel="alternate" type="text/html"/>
  <updated>2008-03-05T10:17:44+00:00</updated>
  <entry>
    <author>
      <name>Igor</name>
    </author>
    <id>urn:uuid:b9b38381-3e36-4a29-be0b-0cb8f0812511</id>
    <published>2008-03-05T10:17:38+00:00</published>
    <updated>2008-03-05T10:17:44+00:00</updated>
    <title>Comment on Selenium on Rails by Igor</title>
    <link href="http://andthennothing.net/archives/2006/02/05/selenium-on-rails#comment-2558" rel="alternate" type="text/html"/>
    <content type="html">Hi Jonas.
Where can i see the by seleniumOnRails produces HTML-Output? I have a little problem with the .rsel-tests and AJAX. After click "commit" on ajax-form, only the partial is loaded (though is correct) but the other stuff like layouts and css is gone (i see like only the partial output not the whole page). The same test runs completely correct in selenium-IDE. Thank you in advance.</content>
  </entry>
  <entry>
    <author>
      <name>nullkhairi</name>
    </author>
    <id>urn:uuid:6fc84eaa-a09d-4f20-905b-2fd9bbd13633</id>
    <published>2006-12-10T09:57:48+00:00</published>
    <updated>2006-12-10T09:57:51+00:00</updated>
    <title>Comment on Selenium on Rails by nullkhairi</title>
    <link href="http://andthennothing.net/archives/2006/02/05/selenium-on-rails#comment-2439" rel="alternate" type="text/html"/>
    <content type="html">I AM STUDENT RFOM IRAQ I NEED SEARCH ABOUT   SELENIUM ELEMENT  IF U CAN HELP ME WITH MY REGARDS ...</content>
  </entry>
  <entry>
    <author>
      <name>Jonas</name>
    </author>
    <id>urn:uuid:066ef8a4-aeb6-4f04-a7d4-df04fda233ef</id>
    <published>2006-05-11T22:46:41+00:00</published>
    <updated>2006-05-11T22:46:41+00:00</updated>
    <title>Comment on Selenium on Rails by Jonas</title>
    <link href="http://andthennothing.net/archives/2006/02/05/selenium-on-rails#comment-1176" rel="alternate" type="text/html"/>
    <content type="html">Thank you CH! I've updated the svn repository.</content>
  </entry>
  <entry>
    <author>
      <name>CH</name>
    </author>
    <id>urn:uuid:8aff8e06-c8c4-477b-b5d1-8f41a1361e62</id>
    <published>2006-05-04T22:16:13+00:00</published>
    <updated>2006-05-04T22:16:28+00:00</updated>
    <title>Comment on Selenium on Rails by CH</title>
    <link href="http://andthennothing.net/archives/2006/02/05/selenium-on-rails#comment-1167" rel="alternate" type="text/html"/>
    <content type="html">The SeleniumOnRails::FixtureLoader in Selenium on Rails tries to use every file under /test/fixtures when calling /selenium/setup?fixtures=all

I'm using an image fixture for testing file upload, and I have image.gif in /test/fixtures.

Changing the available_fixtures method seems to fix the problem:

  def available_fixtures
     files = Dir["test/fixtures/*.{yml,csv}"]
     files.collect {|f| f.sub(/\.[^.]*$/, '').sub('test/fixtures/', '')}
  end
</content>
  </entry>
  <entry>
    <author>
      <name>Anon</name>
    </author>
    <id>urn:uuid:c04b7f37-1ded-4155-8dfc-59ca4ecb742c</id>
    <published>2006-03-27T17:58:28+00:00</published>
    <updated>2006-03-27T17:58:35+00:00</updated>
    <title>Comment on Selenium on Rails by Anon</title>
    <link href="http://andthennothing.net/archives/2006/02/05/selenium-on-rails#comment-969" rel="alternate" type="text/html"/>
    <content type="html">Can't wait to try this out. Thanks for fully developing it as a plugin </content>
  </entry>
  <entry>
    <author>
      <name>Jonas</name>
    </author>
    <id>urn:uuid:7baf7f3a-10db-41cd-bf33-cf5c059e546b</id>
    <published>2006-02-19T14:30:55+00:00</published>
    <updated>2006-02-19T14:30:57+00:00</updated>
    <title>Comment on Selenium on Rails by Jonas</title>
    <link href="http://andthennothing.net/archives/2006/02/05/selenium-on-rails#comment-689" rel="alternate" type="text/html"/>
    <content type="html">Shinya: the new version is enabled for test environment only by default.&lt;br /&gt;&lt;br /&gt;

Eric: your patch is included in the new version. Thanks a bunch!</content>
  </entry>
  <entry>
    <author>
      <name>Jonas</name>
    </author>
    <id>urn:uuid:906bf79e-8d45-4e4e-8759-a21976433ed1</id>
    <published>2006-02-16T08:14:27+00:00</published>
    <updated>2006-02-16T08:14:28+00:00</updated>
    <title>Comment on Selenium on Rails by Jonas</title>
    <link href="http://andthennothing.net/archives/2006/02/05/selenium-on-rails#comment-674" rel="alternate" type="text/html"/>
    <content type="html">No, the two plugins are two different solutions to the same problem. If you want to write the tests in Ruby and use my plugin, Erik's patch above is the closest match at the moment. Have you noticed &lt;a href='http://andthennothing.net/archives/2006/02/08/selenium-ide' rel="nofollow"&gt;Selenium IDE&lt;/a&gt;? It's a neat way to author and edit Selenese test files.</content>
  </entry>
  <entry>
    <author>
      <name>lstrecv</name>
    </author>
    <id>urn:uuid:1fedbac8-29af-4812-b1f5-c45c62008a5e</id>
    <published>2006-02-16T06:26:11+00:00</published>
    <updated>2006-02-16T06:26:22+00:00</updated>
    <title>Comment on Selenium on Rails by lstrecv</title>
    <link href="http://andthennothing.net/archives/2006/02/05/selenium-on-rails#comment-673" rel="alternate" type="text/html"/>
    <content type="html">&lt;a href='http://svn.viney.net.nz/things/rails/plugins/selenium_testing/README' rel="nofollow"&gt;http://svn.viney.net.nz/things/rails/plugins/selenium_testing/README&lt;/a&gt;

Do you interface with this, use this?</content>
  </entry>
  <entry>
    <author>
      <name>Eric</name>
    </author>
    <id>urn:uuid:96c1cec1-a392-42ff-b6a7-233538ccb14b</id>
    <published>2006-02-15T21:40:32+00:00</published>
    <updated>2006-02-15T21:40:33+00:00</updated>
    <title>Comment on Selenium on Rails by Eric</title>
    <link href="http://andthennothing.net/archives/2006/02/05/selenium-on-rails#comment-672" rel="alternate" type="text/html"/>
    <content type="html">&lt;p&gt;I'm glad you like it! I included rdoc and test cases and tried to stick to your style as much as possible.&lt;/p&gt;

&lt;p&gt;And yes, method_missing would be a perfectly valid approach. I put in stubs for two reasons:&lt;/p&gt;


&lt;ol&gt;
&lt;li&gt;It gives rdoc something to document, and&lt;/li&gt;
&lt;li&gt;It would allow future support for keyword arguments, such as ':regex ...', where Selenium has multiple argument formats.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I think that (1) is useful, and (2) is probably not important. So it's up to you how it should work!&lt;/p&gt;

&lt;p&gt;The one thing that I didn't include was easy support for loading fixtures before generating the tables.  There's a really nice version of that {{&lt;a href='http://blog.viney.net.nz/articles/2006/02/09/selenium-testing' rel="nofollow"&gt;here&lt;/a&gt;}}, but I'm not quite sure how it might work in Selenium On Rails.&lt;/p&gt;

&lt;p&gt;Once again, my many thanks for a great plugin! It's going to make several upcoming projects much easier.&lt;/p&gt;</content>
  </entry>
  <entry>
    <author>
      <name>Jonas</name>
    </author>
    <id>urn:uuid:a8f2e667-d649-4963-83ba-1e65c48f4461</id>
    <published>2006-02-15T21:02:48+00:00</published>
    <updated>2006-02-15T21:02:50+00:00</updated>
    <title>Comment on Selenium on Rails by Jonas</title>
    <link href="http://andthennothing.net/archives/2006/02/05/selenium-on-rails#comment-671" rel="alternate" type="text/html"/>
    <content type="html">Nice patch Erik, good job!&lt;br /&gt;&lt;br /&gt;

I've just browsed through the code briefly, but I have one question: don't you think it's better to use &lt;tt&gt;method_missing&lt;/tt&gt; where no logic is required? It would result in less code and would support &lt;tt&gt;user-extensions.js&lt;/tt&gt;.&lt;br /&gt;&lt;br /&gt;

I'm currently working on rake task support, so I will look into it further when I'm done with that.</content>
  </entry>
  <entry>
    <author>
      <name>Eric</name>
    </author>
    <id>urn:uuid:3374e398-70cf-4f5e-8899-e9011080531f</id>
    <published>2006-02-15T14:06:25+00:00</published>
    <updated>2006-02-15T14:06:26+00:00</updated>
    <title>Comment on Selenium on Rails by Eric</title>
    <link href="http://andthennothing.net/archives/2006/02/05/selenium-on-rails#comment-670" rel="alternate" type="text/html"/>
    <content type="html">&lt;p&gt;Thanks for the cool plugin, Jonas! I agree, sometimes it's good to duplicate constants.  Other times, though, I just want to write:&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;&lt;notextile&gt;|assertTitle|#{SITE_NAME}|&lt;/notextile&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;...and not worry about updating a bunch of test cases when the site name changes. Similarly, I may not want manually update 20 test cases if I re-route some internal URLs.&lt;/p&gt;

&lt;p&gt;My ideal goal is "Once and Only Once": each piece of knowledge should be represented in a single place, and tested in a single place. Perhaps my traditional controller tests already check that certain URLs get routed correctly, and I don't want that information to be duplicated throughout my Selenium tests.&lt;/p&gt;

&lt;p&gt;I hope this make some kind of deranged sense, at least. ;-) In any case--on the off chance you find my patch useful--you're welcome to do anything you want with it. It's the least I can do to thank you for making my life much easier!&lt;/p&gt;</content>
  </entry>
  <entry>
    <author>
      <name>Eric</name>
    </author>
    <id>urn:uuid:5889381e-f861-44a2-9000-667a4aa7d122</id>
    <published>2006-02-15T13:50:40+00:00</published>
    <updated>2006-02-15T13:50:44+00:00</updated>
    <title>Comment on Selenium on Rails by Eric</title>
    <link href="http://andthennothing.net/archives/2006/02/05/selenium-on-rails#comment-669" rel="alternate" type="text/html"/>
    <content type="html">&lt;p&gt;OK, I decided to actually write some code. :-) Click on my name for a patch which enhances Selenium on Rails to support native Ruby test cases, including configuration data and URL routing.&lt;/p&gt;

&lt;p&gt;Here's a sample:&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;&lt;notextile&gt;test.setup # Load fixtures
test.open :controller =&amp;gt; 'customer',
          :action =&amp;gt; 'list'
test.assert_title 'Customers'
test.click 'myLink', :wait =&amp;gt; true
test.assert_title 'Customer: *'&lt;/notextile&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

You can &lt;a href='http://www.randomhacks.net/articles/2006/02/15/selenium-on-rails-reloaded' rel="nofollow"&gt;download my patch from here&lt;/a&gt;. (Yes, there's really a link there, even though it isn't underlined.)</content>
  </entry>
  <entry>
    <author>
      <name>Jonas</name>
    </author>
    <id>urn:uuid:1496f62c-e411-41af-beb6-657ec0efbee1</id>
    <published>2006-02-14T21:27:53+00:00</published>
    <updated>2006-02-14T21:27:56+00:00</updated>
    <title>Comment on Selenium on Rails by Jonas</title>
    <link href="http://andthennothing.net/archives/2006/02/05/selenium-on-rails#comment-668" rel="alternate" type="text/html"/>
    <content type="html">Thanks Erik! I'll consider it, but isn't it good with duplication in this case? If the constants change for some reason, don't you want the tests to fail?&lt;br /&gt;&lt;br /&gt;

Do you have any example of what kind of constant you're talking about?</content>
  </entry>
  <entry>
    <author>
      <name>Eric</name>
    </author>
    <id>urn:uuid:0cf11fc8-5c19-479c-a4ca-5f4cf97b2da5</id>
    <published>2006-02-14T13:05:46+00:00</published>
    <updated>2006-02-14T13:05:48+00:00</updated>
    <title>Comment on Selenium on Rails by Eric</title>
    <link href="http://andthennothing.net/archives/2006/02/05/selenium-on-rails#comment-666" rel="alternate" type="text/html"/>
    <content type="html">Great plugin! One thought: It would be really nice to be able to use ERB from within Selenese. This way, I could look up site configuration variables and use them in test cases, eliminating some unnecessary duplication of constants.</content>
  </entry>
  <entry>
    <author>
      <name>Jonas</name>
    </author>
    <id>urn:uuid:a3b2b55a-8a3d-40b3-a61a-db3f3d724694</id>
    <published>2006-02-08T22:20:33+00:00</published>
    <updated>2006-02-08T22:20:35+00:00</updated>
    <title>Comment on Selenium on Rails by Jonas</title>
    <link href="http://andthennothing.net/archives/2006/02/05/selenium-on-rails#comment-613" rel="alternate" type="text/html"/>
    <content type="html">Thanks for sorting that out Shinya! &lt;br /&gt;&lt;br /&gt;

I agree that the plugin should only be available for test environment per default. It has been available for development due to convenience, but I'll change it.</content>
  </entry>
  <entry>
    <author>
      <name>Shinya</name>
    </author>
    <id>urn:uuid:598595e0-b037-4f91-a082-b3448aa5243f</id>
    <published>2006-02-08T03:20:59+00:00</published>
    <updated>2006-02-08T03:21:00+00:00</updated>
    <title>Comment on Selenium on Rails by Shinya</title>
    <link href="http://andthennothing.net/archives/2006/02/05/selenium-on-rails#comment-595" rel="alternate" type="text/html"/>
    <content type="html">&lt;p&gt;
What do you think about adding an option to disable Selenium in development environment?
&lt;/p&gt;
&lt;p&gt;
If you don't use fixtures, enabling Selenium in development environment would be useful. But if you do use fixtures, I prefer to disable it because it will mess up the development database.
&lt;/p&gt;
</content>
  </entry>
  <entry>
    <author>
      <name>Shinya</name>
    </author>
    <id>urn:uuid:050b28cc-11d1-4fab-838d-a6390cf5bec0</id>
    <published>2006-02-08T01:50:40+00:00</published>
    <updated>2006-02-08T01:50:41+00:00</updated>
    <title>Comment on Selenium on Rails by Shinya</title>
    <link href="http://andthennothing.net/archives/2006/02/05/selenium-on-rails#comment-594" rel="alternate" type="text/html"/>
    <content type="html">Jonas, thanks for the new version. It's working very well.

I found that link= locator doesn't work in Selenium gem, but works if you install Selenium from svn into vendor/selenium/javascript. It seems that the gem version is too old...
</content>
  </entry>
  <entry>
    <author>
      <name>Jonas</name>
    </author>
    <id>urn:uuid:08bfe6ef-120f-48e7-8e43-ded9b5245309</id>
    <published>2006-02-07T23:37:21+00:00</published>
    <updated>2006-02-07T23:38:34+00:00</updated>
    <title>Comment on Selenium on Rails by Jonas</title>
    <link href="http://andthennothing.net/archives/2006/02/05/selenium-on-rails#comment-592" rel="alternate" type="text/html"/>
    <content type="html">Check the new version out and see if it addresses your issues!&lt;br /&gt;&lt;br /&gt;

Shinya: Thanks! Selenium IDE looks great! I'll try it out some time...&lt;br /&gt;&lt;br /&gt;

Joe: link=linktext doesn't work for me either, but I have no idea why. I don't understand how this could be the plugin's fault though. Let me know if you sort it out.</content>
  </entry>
  <entry>
    <author>
      <name>Joe</name>
    </author>
    <id>urn:uuid:2821334c-5b39-4795-a07e-31e10e2816de</id>
    <published>2006-02-07T18:43:13+00:00</published>
    <updated>2006-02-07T18:43:14+00:00</updated>
    <title>Comment on Selenium on Rails by Joe</title>
    <link href="http://andthennothing.net/archives/2006/02/05/selenium-on-rails#comment-579" rel="alternate" type="text/html"/>
    <content type="html">I'm trying to use this (looks great), however I get errors when it tries to use element locators like "link=some link text to match" - it shows an error "Element link=some link text to match not found"

Anyone else getting this?</content>
  </entry>
  <entry>
    <author>
      <name>Shinya</name>
    </author>
    <id>urn:uuid:fe1369f8-b8dd-45fc-b413-23ea06cf9fb7</id>
    <published>2006-02-07T08:11:06+00:00</published>
    <updated>2006-02-07T08:11:12+00:00</updated>
    <title>Comment on Selenium on Rails by Shinya</title>
    <link href="http://andthennothing.net/archives/2006/02/05/selenium-on-rails#comment-566" rel="alternate" type="text/html"/>
    <content type="html">Comment on Vincent's patch: I also had to modify it to skip files that end with "~", which is an Emacs backup file.
</content>
  </entry>
  <entry>
    <author>
      <name>Shinya</name>
    </author>
    <id>urn:uuid:b9b62606-aed8-4142-a44e-b3ce46aeeebc</id>
    <published>2006-02-07T07:28:37+00:00</published>
    <updated>2006-02-07T07:28:38+00:00</updated>
    <title>Comment on Selenium on Rails by Shinya</title>
    <link href="http://andthennothing.net/archives/2006/02/05/selenium-on-rails#comment-563" rel="alternate" type="text/html"/>
    <content type="html">Very nice plugin!
I'm an author of Selenium IDE which has been released recently (see &lt;a href='http://www.openqa.org/selenium-ide/' rel="nofollow"&gt;http://www.openqa.org/selenium-ide/&lt;/a&gt;), and I've added a custom format to Wiki that can be used to edit tests for Selenium on Rails.

&lt;a href='http://wiki.openqa.org/display/SIDE/SeleniumOnRails' rel="nofollow"&gt;http://wiki.openqa.org/display/SIDE/SeleniumOnRails&lt;/a&gt;
</content>
  </entry>
  <entry>
    <author>
      <name>Vincent</name>
    </author>
    <id>urn:uuid:3eb49bee-f89e-4ebf-815f-4dc148163d3e</id>
    <published>2006-02-07T06:02:16+00:00</published>
    <updated>2006-02-07T23:40:16+00:00</updated>
    <title>Comment on Selenium on Rails by Vincent</title>
    <link href="http://andthennothing.net/archives/2006/02/05/selenium-on-rails#comment-560" rel="alternate" type="text/html"/>
    <content type="html">That's just awesome thanks! I gonna start using it.&lt;br /&gt;

I've used the generator to produce a simple test and could run the tests. However, rake test produces errors: 28 tests, 58 assertions, 6 failures, 0 errors&lt;br /&gt;

any idea? I am running ruby 1.8.3 on Ubuntu&lt;br /&gt;

I also noticed that .svn directories are listed as test suites, so I wrote a small patch to omit hidden files:&lt;br /&gt;

Index: vendor/plugins/selenium_on_rails/lib/selenium_on_rails/suite_renderer.rb&lt;br /&gt;
===================================================================&lt;br /&gt;
--- vendor/plugins/selenium_on_rails/lib/selenium_on_rails/suite_renderer.rb    (revision 2)&lt;br /&gt;
+++ vendor/plugins/selenium_on_rails/lib/selenium_on_rails/suite_renderer.rb    (working copy)&lt;br /&gt;
@@ -37,6 +37,7 @@&lt;br /&gt;
       dirs = [] #add dirs to an array in order for files to be processed before dirs&lt;br /&gt;
       Dir.entries(path).each do |e|&lt;br /&gt;
         next if ['.','..'].include? e&lt;br /&gt;
+        next if e.starts_with? '.'&lt;br /&gt;
         filename = File.join path, e&lt;br /&gt;
         if File.directory? filename&lt;br /&gt;
           dirs &amp;lt;&amp;lt; [filename, "#{suite_name}#{e.humanize}."]&lt;br /&gt;</content>
  </entry>
  <entry>
    <author>
      <name>Wayne</name>
    </author>
    <id>urn:uuid:db8679b3-6b1e-4cc0-9b02-0a9ab3404df1</id>
    <published>2006-02-07T05:34:44+00:00</published>
    <updated>2006-02-07T05:34:44+00:00</updated>
    <title>Comment on Selenium on Rails by Wayne</title>
    <link href="http://andthennothing.net/archives/2006/02/05/selenium-on-rails#comment-559" rel="alternate" type="text/html"/>
    <content type="html">Suite, that works!  (pardon the pun...)

I was still getting unbalanced newlines (and 6 test failures), so I changed your clean_text method to:
    text.gsub("\t", '  ').gsub("\r\n", "").gsub("\n","")
to just get rid of em all.

Thanks for the update!</content>
  </entry>
  <entry>
    <author>
      <name>Jonas</name>
    </author>
    <id>urn:uuid:d478d9da-7706-469c-8bd9-e5905f92f933</id>
    <published>2006-02-07T01:10:22+00:00</published>
    <updated>2006-02-07T01:10:22+00:00</updated>
    <title>Comment on Selenium on Rails by Jonas</title>
    <link href="http://andthennothing.net/archives/2006/02/05/selenium-on-rails#comment-552" rel="alternate" type="text/html"/>
    <content type="html">Wayne, could you please try the new version out?</content>
  </entry>
  <entry>
    <author>
      <name>Peter</name>
    </author>
    <id>urn:uuid:d2e06c60-90e5-4671-892c-615fe9db9882</id>
    <published>2006-02-06T23:01:39+00:00</published>
    <updated>2006-02-06T23:01:41+00:00</updated>
    <title>Comment on Selenium on Rails by Peter</title>
    <link href="http://andthennothing.net/archives/2006/02/05/selenium-on-rails#comment-549" rel="alternate" type="text/html"/>
    <content type="html">This looks very promising. Good work! </content>
  </entry>
  <entry>
    <author>
      <name>Jonas Bengtsson</name>
      <email>jonas.b@home.se</email>
    </author>
    <id>urn:uuid:23a411c8-5ad8-43f3-8b27-a9f2030a9ff4</id>
    <published>2006-02-05T23:49:00+00:00</published>
    <updated>2007-09-03T00:37:01+00:00</updated>
    <title>Selenium on Rails</title>
    <link href="http://andthennothing.net/archives/2006/02/05/selenium-on-rails" rel="alternate" type="text/html"/>
    <content type="html">&lt;p&gt;&lt;ins&gt;Selenium on Rails has &lt;a href="http://www.openqa.org/selenium-on-rails/"&gt;moved&lt;/a&gt;.&lt;/ins&gt;&lt;/p&gt;


	&lt;p&gt;&lt;ins&gt;New &lt;a href="http://andthennothing.net/archives/2006/02/19/new-version-of-selenium-on-rails"&gt;version&lt;/a&gt;.&lt;/ins&gt;&lt;/p&gt;


	&lt;p&gt;&lt;ins&gt;Updates at the end.&lt;/ins&gt;&lt;/p&gt;


	&lt;p&gt;One of the things I like about Rails is the built-in support for testing &amp;#8211; it&amp;#8217;s almost hard not to write tests. But even if I write extensive tests (currently &amp;#8220;Code to Test Ratio: 1:3.4&amp;#8221; according to &lt;code&gt;rake stats&lt;/code&gt; in a small toy project) I still feel that it&amp;#8217;s not enough. I occasionally get the urge to fire up the browser and click around to test that everything works. You shouldn&amp;#8217;t have to &amp;#8220;click around&amp;#8221; to test that you haven&amp;#8217;t broken anything that often (although it&amp;#8217;s probably good to use the browser for checking usability).&lt;/p&gt;


	&lt;p&gt;That&amp;#8217;s where &lt;a href="http://www.openqa.org/selenium/"&gt;Selenium&lt;/a&gt; comes in. It&amp;#8217;s a javascript based functional test tool that uses &lt;a href="http://fit.c2.com/"&gt;Fit&lt;/a&gt; like test scripts to test web application directly in the browser. There are other ways to test in browsers, like &lt;a href="http://wtr.rubyforge.org/"&gt;Watir&lt;/a&gt;, but they don&amp;#8217;t run in any browser/platform so I think that javascript based solutions are the way to go. And for javascript based solutions I don&amp;#8217;t know if there are any competition at all.&lt;/p&gt;


	&lt;p&gt;However, I didn&amp;#8217;t think that vanilla Selenium worked as smooth as it should in a Rails context. So I&amp;#8217;ve been writing a plug-in that makes the experience much better, &lt;span class="caps"&gt;IMHO&lt;/span&gt;. It took a bit longer than what I thought, but I&amp;#8217;ve been busy and stuff like this takes time to get into a good enough state to release to the world.&lt;/p&gt;


	&lt;p&gt;Please try it out and let me know if you have any problems using it or if you have suggestions for improvements!&lt;/p&gt;


	&lt;h3&gt;Overview&lt;/h3&gt;


	&lt;p&gt;Selenium on Rails provides an easy way to test Rails application with &lt;a href="http://www.openqa.org/selenium/"&gt;Selenium&lt;/a&gt;.&lt;/p&gt;


This plugin does four things:
	&lt;ol&gt;
	&lt;li&gt;The Selenium files don&amp;#8217;t have to pollute &lt;tt&gt;/public&lt;/tt&gt;, they can stay in the Selenium gem or in &lt;tt&gt;/vendor/selenium/javascript&lt;/tt&gt;.&lt;/li&gt;
		&lt;li&gt;No need to create suite files, they are generated on the fly&amp;#8212;one suite per directory in &lt;tt&gt;/test/selenium&lt;/tt&gt; (suites can be nested).&lt;/li&gt;
		&lt;li&gt;Instead of writing the test cases in &lt;span class="caps"&gt;HTML&lt;/span&gt; you can use ERb/RHTML or Selenese (a template provided by this plugin).&lt;/li&gt;
		&lt;li&gt;Loading of fixtures and wiping of session (&lt;tt&gt;/selenium/setup&lt;/tt&gt;).&lt;/li&gt;
	&lt;/ol&gt;


	&lt;p&gt;Selenium on Rails is disabled for production environments.&lt;/p&gt;


	&lt;h3&gt;Installation&lt;/h3&gt;


	&lt;ol&gt;
	&lt;li&gt;Selenium needs to be available. It could either be installed as a gem (&lt;tt&gt;gem install selenium&lt;/tt&gt;) or in &lt;tt&gt;/vendor/selenium/&lt;/tt&gt;.&lt;/li&gt;
		&lt;li&gt;Install Selenium on Rails: &lt;tt&gt;script/plugin install http://andthennothing.net/svn/public/selenium_on_rails/&lt;/tt&gt;&lt;/li&gt;
		&lt;li&gt;&lt;em&gt;If RedCloth is available the Selenese test cases can use it for better markup.&lt;/em&gt;&lt;/li&gt;
		&lt;li&gt;Run the Rakefile in the plugin&amp;#8217;s directory to run the tests in order to see that everything works. (If RedCloth isn&amp;#8217;t installed a few tests will fail since they assume RedCloth is installed.)&lt;/li&gt;
		&lt;li&gt;Create a test case: &lt;tt&gt;script/generate selenium login&lt;/tt&gt;&lt;/li&gt;
		&lt;li&gt;Start the server: &lt;tt&gt;script/server&lt;/tt&gt;&lt;/li&gt;
		&lt;li&gt;Point your browser to &lt;tt&gt;http://localhost:3000/selenium&lt;/tt&gt;&lt;/li&gt;
		&lt;li&gt;If everything works as expected you should see the Selenium test runner. The north east frame contains all your test cases (just one for now), and the north frame contains your test case.&lt;/li&gt;
	&lt;/ol&gt;


	&lt;h3&gt;Todo&lt;/h3&gt;


	&lt;h4&gt;user_extension.js&lt;/h4&gt;


	&lt;p&gt;Selenium has support for &lt;tt&gt;user_extension.js&lt;/tt&gt; which is a way to extend the 
functionality of Selenium. However there is currently no easy way to add such a
file in Selenium on Rails.&lt;/p&gt;


	&lt;h4&gt;Partials&lt;/h4&gt;


	&lt;p&gt;It would be nice if common parts of test cases could be stored in partials.&lt;/p&gt;


	&lt;h4&gt;More setup/teardown support?&lt;/h4&gt;


	&lt;p&gt;Currently there is only support to load fixtures and to wipe the session in
&lt;tt&gt;/selenium/setup&lt;/tt&gt;. Is there a need for more kinds of setups or teardowns?&lt;/p&gt;


	&lt;h3&gt;Credits&lt;/h3&gt;


	&lt;ul&gt;
	&lt;li&gt;Jon Tirsen&amp;#8212;initial &lt;a href="http://wiki.rubyonrails.com/rails/pages/SeleniumIntegration"&gt;inspiration&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;


	&lt;h3&gt;Contact&lt;/h3&gt;


	&lt;p&gt;Jonas Bengtsson, jonas.b@home.se, &lt;a href="http://andthennothing.net"&gt;http://andthennothing.net&lt;/a&gt;&lt;/p&gt;


&lt;hr /&gt;


	&lt;p&gt;&lt;ins&gt;Update:&lt;/ins&gt; The first defect fix is out. It should now work on EdgeRails as well as Rails 1.0.0 (might work on other versions). And the tests ought to pass on non-Windows machines. &lt;em&gt;Thanks Wayne for reporting these errors!&lt;/em&gt;&lt;/p&gt;


	&lt;p&gt;&lt;tt&gt;script/plugin update&lt;/tt&gt; (or reinstall the plugin if that doesn&amp;#8217;t work)&lt;/p&gt;


	&lt;p&gt;&lt;ins&gt;Update 2:&lt;/ins&gt; Another defect fix to make sure .files, and files~ are handled correctly, and updated the tests (they work on Windows and NetBSD at least). &lt;em&gt;Thanks Wayne, Vincent and Shinya!&lt;/em&gt;&lt;/p&gt;


	&lt;p&gt;&lt;ins&gt;Update 3:&lt;/ins&gt; New &lt;a href="http://andthennothing.net/archives/2006/02/19/new-version-of-selenium-on-rails"&gt;version&lt;/a&gt;.&lt;/p&gt;</content>
  </entry>
</feed>
