<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>andthennothing.net: Selenium on Rails is getting DRYer</title>
    <link>http://www.andthennothing.net/archives/2006/05/02/selenium-on-rails-is-getting-dryer</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>&amp;ldquo;first there was a three-legged monkey...&amp;rdquo;</description>
    <item>
      <title>"Selenium on Rails is getting DRYer" by Jonas</title>
      <description>Jitu: I'm not sure I understand what you want. How and where do you want to use CSV and "normal" files in selenium script?  Also it's probably better if you use the &lt;a href='http://forums.openqa.org/forum.jspa?forumID=26' rel="nofollow"&gt;&lt;u&gt;user forum&lt;/u&gt;&lt;/a&gt;.</description>
      <pubDate>Wed, 16 Aug 2006 22:20:15 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:11e79663-4224-4d50-be52-ab5800206e69</guid>
      <link>http://www.andthennothing.net/archives/2006/05/02/selenium-on-rails-is-getting-dryer#comment-1363</link>
    </item>
    <item>
      <title>"Selenium on Rails is getting DRYer" by Jitu</title>
      <description>Hi,

Can you please guide me how to call a CSV file and a normal file to a Selenium script ?

Please help me.

Thanks,
Jitu</description>
      <pubDate>Mon, 14 Aug 2006 12:02:27 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:62754913-603c-485a-a716-ac0c65ecc9dd</guid>
      <link>http://www.andthennothing.net/archives/2006/05/02/selenium-on-rails-is-getting-dryer#comment-1350</link>
    </item>
    <item>
      <title>"Selenium on Rails is getting DRYer" by Erkki</title>
      <description>Jonas: I have a setup where I need to set user/login info through session variables. I cannot login through selenium because the login is not handled by the rails app I'm trying to test.

I figure it should be possible to specify the parameters in the setup url.

Perhaps a better solution would be another setup-session url where information could be posted?</description>
      <pubDate>Sun, 21 May 2006 13:13:49 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:e7302310-061e-496c-9446-6ff010242e77</guid>
      <link>http://www.andthennothing.net/archives/2006/05/02/selenium-on-rails-is-getting-dryer#comment-1185</link>
    </item>
    <item>
      <title>"Selenium on Rails is getting DRYer" by Jonas</title>
      <description>Erkki: No, not currently. What kind of data would you like to set in the session? Do you think it would possible to specify the data in the query part of the "setup" URL?</description>
      <pubDate>Wed, 17 May 2006 18:03:41 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:3f5a63e0-dcb2-45c9-b5b4-fb31e087f87b</guid>
      <link>http://www.andthennothing.net/archives/2006/05/02/selenium-on-rails-is-getting-dryer#comment-1184</link>
    </item>
    <item>
      <title>"Selenium on Rails is getting DRYer" by Jonas</title>
      <description>Shinya: Okey. I'll look at Selenium RC later on to see if it fits. But it will take some time since I'm quite busy. Let me know if you come up with an idea of how to incorporate it!</description>
      <pubDate>Wed, 17 May 2006 17:58:08 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:59452d2a-f654-45fc-b2fd-9f0368fb5e29</guid>
      <link>http://www.andthennothing.net/archives/2006/05/02/selenium-on-rails-is-getting-dryer#comment-1183</link>
    </item>
    <item>
      <title>"Selenium on Rails is getting DRYer" by Erkki</title>
      <description>Is it possible to pre-setup session data when running selenium tests?</description>
      <pubDate>Wed, 17 May 2006 13:40:32 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:fc2bc0e6-3bbd-42d0-9d04-c3a31f8362dd</guid>
      <link>http://www.andthennothing.net/archives/2006/05/02/selenium-on-rails-is-getting-dryer#comment-1182</link>
    </item>
    <item>
      <title>"Selenium on Rails is getting DRYer" by Shinya</title>
      <description>Thanks for incorporating the patch, Jonas.
&lt;br /&gt;
Selenium RC has significantly changed since the driven mode in Selenium.

Personally I think the TestRunner in Selenium, as used in Selenium on Rails, has the advantage in its simplicity (you don't need to run Selenium Server, and you can easily run tests using the web UI), but when you want to start using variables and conditions in your test, Selenium RC can handle it very well.
</description>
      <pubDate>Fri, 12 May 2006 06:32:59 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:9f16c66d-54dd-4010-8882-66e4608cdf3b</guid>
      <link>http://www.andthennothing.net/archives/2006/05/02/selenium-on-rails-is-getting-dryer#comment-1178</link>
    </item>
    <item>
      <title>"Selenium on Rails is getting DRYer" by Jonas</title>
      <description>Hi Shinya,&lt;br /&gt;&lt;br /&gt;

The patch is included in the svn repository, thank you!&lt;br /&gt;&lt;br /&gt;

I've heard about the Selenium RC but not looked into it. Has RC been developed much lately or is it the same as what was included in the old Selenium project?</description>
      <pubDate>Thu, 11 May 2006 23:04:05 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:0807fe7a-6f3c-4138-904e-32900676763c</guid>
      <link>http://www.andthennothing.net/archives/2006/05/02/selenium-on-rails-is-getting-dryer#comment-1177</link>
    </item>
    <item>
      <title>"Selenium on Rails is getting DRYer" by Shinya</title>
      <description>&lt;p&gt;
Hi,
&lt;/p&gt;
&lt;p&gt;
I've started putting Selenium on Rails into our continuous integration cycle, but even if test_acceptance fails with some errors, rake doesn't return an error. So I've created a patch that fixes this: &lt;a href='http://www.kbmj.com/' rel="nofollow"&gt;http://www.kbmj.com/&lt;/a&gt;~shinya/selenium_on_rails/raise_test_failure.patch
&lt;/p&gt;
&lt;p&gt;
BTW, have you checked out Selenium Remote Control? This allows you to control Selenium remotely using Ruby code, and it would be great if it gets integrated into Rails.
&lt;/p&gt;
</description>
      <pubDate>Thu, 11 May 2006 10:42:56 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:ff6103ea-fdb6-4be9-a3d9-b1bfd5f4e46a</guid>
      <link>http://www.andthennothing.net/archives/2006/05/02/selenium-on-rails-is-getting-dryer#comment-1174</link>
    </item>
    <item>
      <title>"Selenium on Rails is getting DRYer" by Jonas</title>
      <description>I just made that change to the svn repository. Hope it helps!</description>
      <pubDate>Thu, 04 May 2006 00:06:19 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:b2da552c-3025-48c7-8632-5468cdddb646</guid>
      <link>http://www.andthennothing.net/archives/2006/05/02/selenium-on-rails-is-getting-dryer#comment-1166</link>
    </item>
    <item>
      <title>"Selenium on Rails is getting DRYer" by Jonas</title>
      <description>It works on my computer :-)&lt;br /&gt;&lt;br /&gt;
Could you check if you have the file &lt;tt&gt;lib/selenium_on_rails/partials_support.rb&lt;/tt&gt;? If so does it work if you add the following line to &lt;tt&gt;/lib/selenium_on_rails.rb&lt;/tt&gt;:
&lt;pre&gt;require 'selenium_on_rails/partials_support'&lt;/pre&gt;</description>
      <pubDate>Wed, 03 May 2006 17:12:50 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:5fe37f6e-c907-4201-9f29-256ad45cdcdb</guid>
      <link>http://www.andthennothing.net/archives/2006/05/02/selenium-on-rails-is-getting-dryer#comment-1165</link>
    </item>
    <item>
      <title>"Selenium on Rails is getting DRYer" by Matt</title>
      <description>There seems to be a problem with the PartialsSupport class.
&lt;br /&gt;
 TestRunner fails with: uninitialized constant PartialsSupport
&lt;br /&gt; on renderer.rb:6:in `render_test_case'</description>
      <pubDate>Wed, 03 May 2006 16:20:07 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:3c4811d8-3376-446e-b602-3961106c15aa</guid>
      <link>http://www.andthennothing.net/archives/2006/05/02/selenium-on-rails-is-getting-dryer#comment-1164</link>
    </item>
    <item>
      <title>Selenium on Rails is getting DRYer</title>
      <description>&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;Selenium on Rails has gotten way too little love lately, but now I just released an update.&lt;/p&gt;


First off, a new feature. It is now possible to create partial test cases and include them in other test cases. That way you can keep common actions in one place and use them in many.
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="comment"&gt;#_login.rsel&lt;/span&gt;
&lt;span class="ident"&gt;open&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;/login&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;
&lt;span class="ident"&gt;type&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;name&lt;/span&gt;&lt;span class="punct"&gt;',&lt;/span&gt; &lt;span class="ident"&gt;name&lt;/span&gt;
&lt;span class="ident"&gt;type&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;password&lt;/span&gt;&lt;span class="punct"&gt;',&lt;/span&gt; &lt;span class="ident"&gt;password&lt;/span&gt;
&lt;span class="ident"&gt;click&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;submit&lt;/span&gt;&lt;span class="punct"&gt;',&lt;/span&gt; &lt;span class="symbol"&gt;:wait=&lt;/span&gt;&lt;span class="punct"&gt;&amp;gt;&lt;/span&gt;&lt;span class="constant"&gt;true&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
To include a partial test case you write like this in a Selenese test case: 
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;|includePartial|login|name=John Doe|password=eoD nhoJ|&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
and in a RSelenese test case: 
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="ident"&gt;include_partial&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;login&lt;/span&gt;&lt;span class="punct"&gt;',&lt;/span&gt; &lt;span class="symbol"&gt;:name&lt;/span&gt; &lt;span class="punct"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;Jane Doe&lt;/span&gt;&lt;span class="punct"&gt;',&lt;/span&gt; &lt;span class="symbol"&gt;:password&lt;/span&gt; &lt;span class="punct"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;Jane Doe&lt;/span&gt;&lt;span class="punct"&gt;'.&lt;/span&gt;&lt;span class="ident"&gt;reverse&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Also included in this release is two defect fixes to &lt;tt&gt;rake test:acceptance&lt;/tt&gt;.&lt;/p&gt;


	&lt;p&gt;The first fix is from David Vollbracht which makes it possible to start the server automatically on *nix. You still have to &lt;tt&gt;start_server: true&lt;/tt&gt; in &lt;tt&gt;config.yml&lt;/tt&gt; since I can&amp;#8217;t get it to work reliably on Windows (if anyone knows why, give me a ping).&lt;/p&gt;


	&lt;p&gt;The second fix is from &lt;a href="http://www.redsquirrel.com/dave/"&gt;Dave Hoover&lt;/a&gt; which adds support for Safari.&lt;/p&gt;


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


	&lt;p&gt;Let me know if it doesn&amp;#8217;t work or if you want it to work differently!&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&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 a number of better formats (see &lt;tt&gt;Formats&lt;/tt&gt;).&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;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;i&gt;If RedCloth is available the Selenese test cases can use it for better markup.&lt;/i&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 -e test&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;h4&gt;win32-open3&lt;/h4&gt;


	&lt;p&gt;&lt;a href="http://raa.ruby-lang.org/project/win32-open3/"&gt;win32-open3&lt;/a&gt; is needed if you&amp;#8217;re
on Windows and want to run your tests as a Rake task 
(see &lt;tt&gt;test:acceptance&lt;/tt&gt;), i.e. you don&amp;#8217;t have to install it but it&amp;#8217;s 
recommended.&lt;/p&gt;


	&lt;p&gt;You can build it from source or install the binary:&lt;/p&gt;


	&lt;ol&gt;
	&lt;li&gt;Download the latest version of win32-open3, &lt;a href="http://rubyforge.org/frs/download.php/8515/open3-0.2.2.so"&gt;open3-0.2.2.so&lt;/a&gt; at the time of this writing.&lt;/li&gt;
		&lt;li&gt;Open up irb and run this snippet: &lt;tt&gt;require &amp;#8216;rbconfig&amp;#8217;; include Config; puts &lt;span class="caps"&gt;CONFIG&lt;/span&gt;[&amp;#8216;sitearchdir&amp;#8217;]&lt;/tt&gt;&lt;/li&gt;
		&lt;li&gt;Create a &lt;tt&gt;win32&lt;/tt&gt; directory under the directory you got, e.g. &lt;tt&gt;c:\ruby\lib\ruby\site_ruby\1.8\i386-msvcrt&lt;/tt&gt;&lt;/li&gt;
		&lt;li&gt;Rename the .so file to &lt;tt&gt;open3.so&lt;/tt&gt; and put it in the &lt;tt&gt;win32&lt;/tt&gt; directory.&lt;/li&gt;
		&lt;li&gt;Profit! (unless you get an error when doing &lt;tt&gt;require &amp;#8216;win32/open3&amp;#8217;&lt;/tt&gt;)&lt;/li&gt;
	&lt;/ol&gt;


	&lt;h3&gt;Formats&lt;/h3&gt;


	&lt;p&gt;The test cases can be written in a number of formats. Which one you choose is a 
matter of taste. You can generate your test files by running 
&lt;tt&gt;script/generate selenium&lt;/tt&gt; or by creating them manually in your 
&lt;tt&gt;/test/selenium&lt;/tt&gt; directory.&lt;/p&gt;


	&lt;h4&gt;Selenese, .sel&lt;/h4&gt;


Selenese is the dumbest format (in a good way). You just write your commands
delimited by | characters.
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;|open|/selenium/setup|
|open|/|
|goBack|&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
If you don&amp;#8217;t want to write Selenese tests by hand you can use
&lt;a href="http://www.openqa.org/selenium-ide/"&gt;SeleniumIDE&lt;/a&gt; which has 
&lt;a href="http://wiki.openqa.org/display/SIDE/SeleniumOnRails"&gt;support&lt;/a&gt; for Selenese.

	&lt;p&gt;SeleniumIDE makes it super easy to record test and edit them.&lt;/p&gt;


	&lt;h4&gt;RSelenese, .rsel&lt;/h4&gt;


RSelenese enable you to write your tests in Ruby.
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="ident"&gt;setup&lt;/span&gt; &lt;span class="symbol"&gt;:fixtures&lt;/span&gt; &lt;span class="punct"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="symbol"&gt;:all&lt;/span&gt;
&lt;span class="ident"&gt;open&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;/&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;
&lt;span class="ident"&gt;assert_title&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;Home&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;
&lt;span class="punct"&gt;('&lt;/span&gt;&lt;span class="string"&gt;a&lt;/span&gt;&lt;span class="punct"&gt;'..'&lt;/span&gt;&lt;span class="string"&gt;z&lt;/span&gt;&lt;span class="punct"&gt;').&lt;/span&gt;&lt;span class="ident"&gt;each&lt;/span&gt; &lt;span class="punct"&gt;{|&lt;/span&gt;&lt;span class="ident"&gt;c&lt;/span&gt;&lt;span class="punct"&gt;|&lt;/span&gt; &lt;span class="ident"&gt;open&lt;/span&gt; &lt;span class="symbol"&gt;:controller&lt;/span&gt; &lt;span class="punct"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;user&lt;/span&gt;&lt;span class="punct"&gt;',&lt;/span&gt; &lt;span class="symbol"&gt;:action&lt;/span&gt; &lt;span class="punct"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;create&lt;/span&gt;&lt;span class="punct"&gt;',&lt;/span&gt; &lt;span class="symbol"&gt;:name&lt;/span&gt; &lt;span class="punct"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="ident"&gt;c&lt;/span&gt; &lt;span class="punct"&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
See SeleniumOnRails::TestBuilder for available commands.

	&lt;h4&gt;HTML/RHTML&lt;/h4&gt;


	&lt;p&gt;You can write your tests in &lt;span class="caps"&gt;HTML&lt;/span&gt;/RHTML but that&amp;#8217;s mostly useful if you have 
existing tests you want to reuse.&lt;/p&gt;


	&lt;h4&gt;Partial test cases&lt;/h4&gt;


	&lt;p&gt;If you have some common actions you want to do in several test cases you can put
them in a separate partial test case and include them in your other test cases.&lt;/p&gt;


	&lt;p&gt;A partial test case is just like a normal test case besides that its filename
has to start with _:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="comment"&gt;#_login.rsel&lt;/span&gt;
&lt;span class="ident"&gt;open&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;/login&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;
&lt;span class="ident"&gt;type&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;name&lt;/span&gt;&lt;span class="punct"&gt;',&lt;/span&gt; &lt;span class="ident"&gt;name&lt;/span&gt;
&lt;span class="ident"&gt;type&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;password&lt;/span&gt;&lt;span class="punct"&gt;',&lt;/span&gt; &lt;span class="ident"&gt;password&lt;/span&gt;
&lt;span class="ident"&gt;click&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;submit&lt;/span&gt;&lt;span class="punct"&gt;',&lt;/span&gt; &lt;span class="symbol"&gt;:wait=&lt;/span&gt;&lt;span class="punct"&gt;&amp;gt;&lt;/span&gt;&lt;span class="constant"&gt;true&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

To include a partial test case you write like this in a Selenese test case:
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;|includePartial|login|name=John Doe|password=eoD nhoJ|&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
in a RSelenese test case:
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="ident"&gt;include_partial&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;login&lt;/span&gt;&lt;span class="punct"&gt;',&lt;/span&gt; &lt;span class="symbol"&gt;:name&lt;/span&gt; &lt;span class="punct"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;Jane Doe&lt;/span&gt;&lt;span class="punct"&gt;',&lt;/span&gt; &lt;span class="symbol"&gt;:password&lt;/span&gt; &lt;span class="punct"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;Jane Doe&lt;/span&gt;&lt;span class="punct"&gt;'.&lt;/span&gt;&lt;span class="ident"&gt;reverse&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
and in a &lt;span class="caps"&gt;RHTML&lt;/span&gt; test case:
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;&amp;lt;%= render :partial =&amp;gt; 'login', :locals =&amp;gt; {:name = 'Joe Schmo', :password =&amp;gt; 'Joe Schmo'.reverse} %&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h3&gt;Configuration&lt;/h3&gt;


	&lt;p&gt;There are a number of settings available. You make them by renaming 
&lt;tt&gt;config.yml.example&lt;/tt&gt; to &lt;tt&gt;config.yml&lt;/tt&gt; and make your changes in that
file.&lt;/p&gt;


	&lt;h4&gt;Environments&lt;/h4&gt;


Per default this plugin is only available in test environment. You can change 
this by setting &lt;tt&gt;environments&lt;/tt&gt;, such as:
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;#config.yml
environments:
  - test
  - development&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h3&gt;&lt;tt&gt;test:acceptance&lt;/tt&gt;&lt;/h3&gt;


	&lt;p&gt;You can run all your Selenium tests as a Rake task.&lt;/p&gt;


First, if you&amp;#8217;re on Windows, you have to make sure win32-open3 is installed. 
Then you have to configure which browsers you want to run, like this:
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;#config.yml
browsers:
  firefox: 'c:\Program Files\Mozilla Firefox\firefox.exe'
  ie: 'c:\Program Files\Internet Explorer\iexplore.exe'&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
Now you&amp;#8217;re all set. First start a server:
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;script/server -e test&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
Then run the tests:
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;rake test:acceptance&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
Now it should work, otherwise let me know!

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


	&lt;h4&gt;Standalone mode&lt;/h4&gt;


	&lt;p&gt;More work is needed on &lt;tt&gt;test:acceptance&lt;/tt&gt; on Windows to be able to start 
the server when needed.&lt;/p&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;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;Not todo&lt;/h3&gt;


	&lt;h4&gt;Editor&lt;/h4&gt;


	&lt;p&gt;Creating an editor for the test cases is currently considered out of scope for 
this plugin. &lt;a href="http://www.openqa.org/selenium-ide/"&gt;SeleniumIDE&lt;/a&gt; does such a good 
job and has &lt;a href="http://wiki.openqa.org/display/SIDE/SeleniumOnRails"&gt;support&lt;/a&gt; for 
the Selenese format.&lt;/p&gt;


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


	&lt;ul&gt;
	&lt;li&gt;&lt;a href="http://jutopia.tirsen.com"&gt;Jon Tirsen&lt;/a&gt;&amp;#8212;&lt;a href="http://wiki.rubyonrails.com/rails/pages/SeleniumIntegration"&gt;initial inspiration&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://www.randomhacks.net"&gt;Eric Kidd&lt;/a&gt;&amp;#8212;contribution of RSelenese&lt;/li&gt;
	&lt;/ul&gt;


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


	&lt;p&gt;&lt;a href="http://andthennothing.net"&gt;Jonas Bengtsson&lt;/a&gt;, jonas.b@home.se&lt;/p&gt;</description>
      <pubDate>Tue, 02 May 2006 21:54:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:324cab3b-21e8-4ca1-8451-aa58c4e83c91</guid>
      <author>jonas.b@home.se (Jonas Bengtsson)</author>
      <link>http://www.andthennothing.net/archives/2006/05/02/selenium-on-rails-is-getting-dryer</link>
      <trackback:ping>http://www.andthennothing.net/articles/trackback/1163</trackback:ping>
    </item>
  </channel>
</rss>
