<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
><channel><title>Ruby on Rails Notes &#187; Testing</title> <atom:link href="http://railsnotes.com/tag/testing/feed/" rel="self" type="application/rss+xml" /><link>http://railsnotes.com</link> <description>A code-heavy brain dump of stuff I come across working on Ruby on Rails projects including Models, ActiveRecord, Views, Controllers, RESTful rails, deployment, server stuff, etc.</description> <lastBuildDate>Sun, 29 Aug 2010 23:45:16 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.0.1</generator> <item><title>Reuse Cucumber step definitions inside step definitions</title><link>http://railsnotes.com/496-reuse-cucumber-step-definitions-inside-step-definitions/</link> <comments>http://railsnotes.com/496-reuse-cucumber-step-definitions-inside-step-definitions/#comments</comments> <pubDate>Sun, 10 May 2009 19:54:41 +0000</pubDate> <dc:creator>Melvin Ram</dc:creator> <category><![CDATA[Other]]></category> <category><![CDATA[bdd]]></category> <category><![CDATA[cucumber]]></category> <category><![CDATA[Testing]]></category><guid
isPermaLink="false">http://www.railsnotes.com/?p=496</guid> <description><![CDATA[Did you know you can reuse steps definitions inside step definitions? Learn how in this blog with an example.]]></description> <content:encoded><![CDATA[<p></p><p>via: <a
href="http://blog.josephwilk.net/ruby/cucumber-waves-goodbye-to-givenscenario.html">Joseph Wilk    » Cucumber waves goodbye to GivenScenario</a>.</p><p>Did you know you can reuse steps definitions inside step definitions? Here&#8217;s what I mean.</p><p>Let&#8217;s say you&#8217;re writing a scenario for Logout and it looks something like this:</p><pre>Scenario: Logout
  Given I am logged in
  When I follow "Logout"
  Then I should see "Logout successful!"
  And I should get a success response</pre><p>Let&#8217;s assumed that before this scenario, you wrote a scenario for logging in like this:</p><pre>Scenario: Login with email
  Given I am not logged in
  And user "melvin@volcanicmarketing.com" with password "secret" and openid " " exists
  When I go to the login page
  And I fill in "email" with "melvin@volcanicmarketing.com"
  And I fill in "password" with "secret"
  And I press "Login"
  Then I should see "Login successful!"
  And I should get a success response</pre><p>Now inside the step definitions for the &#8220;I am logged in&#8221; (from the Logout scenario), you could run through the process of logging in manually or you could reuse a lot of the step definitions you&#8217;ve already written for the &#8220;Login with email&#8221; scenario.</p><p>Here&#8217;s how you do it:</p><p># features/step_definitions/auth_steps.rb</p><pre>Given /^I am logged in$/ do
  Given 'I am not logged in'
  And 'user "melvin@volcanicmarketing.com" with password "secret" and openid " " exists'
  And 'I go to the login page'
  And 'I fill in "email" with "melvin@volcanicmarketing.com"'
  And 'I fill in "password" with "secret"'
  And 'I press "Login"'
end</pre><p>As you can see, you just have to include the step inside single quotes. Pretty cool, huh?</p><p>PS: I am a cucumber beginner so don&#8217;t take anything in this post to be the right way to do things.</p> ]]></content:encoded> <wfw:commentRss>http://railsnotes.com/496-reuse-cucumber-step-definitions-inside-step-definitions/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Behavior Driven Development in Ruby on Rails</title><link>http://railsnotes.com/76-behavior-driven-development-in-ruby-on-rails/</link> <comments>http://railsnotes.com/76-behavior-driven-development-in-ruby-on-rails/#comments</comments> <pubDate>Tue, 03 Feb 2009 03:54:59 +0000</pubDate> <dc:creator>Melvin Ram</dc:creator> <category><![CDATA[Testing]]></category> <category><![CDATA[bdd]]></category> <category><![CDATA[cucumber]]></category> <category><![CDATA[rspec]]></category> <category><![CDATA[shoulda]]></category><guid
isPermaLink="false">http://railsnotes.wordpress.com/?p=76</guid> <description><![CDATA[I&#8217;ll admit it: I&#8217;m not a big fan of testing. I border-line hate it. Why? Mostly because I don&#8217; get it yet and I find that it really doubles or triples the time it takes for me to finish a piece of code. I&#8217;ve watched parts of the Peepcode screencasts on testing. I&#8217;ve read the [...]]]></description> <content:encoded><![CDATA[<p></p><p>I&#8217;ll admit it: I&#8217;m not a big fan of testing. I border-line hate it. Why? Mostly because I don&#8217; get it yet and I find that it really doubles or triples the time it takes for me to finish a piece of code. I&#8217;ve watched parts of the Peepcode screencasts on testing. I&#8217;ve read the testing sections of various books. And I&#8217;ve even watched a few of the videos on testing at Best Tech Videos. It still hadn&#8217;t sunk in. I mean, I understood the code of it but not the &#8220;what&#8217;s in it for me?&#8221; The usual reasons people give are that you&#8217;ll catch broken code as soon as it breaks. Ehh, whatever! I browser test &amp; console test as I write code so I usually know when something is not working as it should. But I hadn&#8217;t given up hope! I was knew that it in concept, it&#8217;s a good idea and that I just didn&#8217;t understand the workflow yet. So I&#8217;ve been looking for something/someone to show me HOW  to do it right. And with the help of Rails Envy podcast, I&#8217;ve found what I&#8217;m looking for&#8230; I think. You can get it here: <a
href="http://www.railsprescriptions.com">http://www.railsprescriptions.com</a></p><p>I&#8217;ve just read the first 31 pages and I&#8217;m excited to give Behavior Driven Development a real shot. My first commercial rails project is a webapp called <a
href="http://www.brainbankhq.com">BrainBank</a>. I didn&#8217;t have to write tests for the billling &amp; accounts parts because I had bought the Rails SaaS Kit by Ben. The parts I added work as I far as I can tell. I&#8217;m probably going to add a few tests for the most critical areas but I&#8217;ve console &amp; browser tested it to an Nth degree so I&#8217;m not going to spend too much time writing tests  for it. I&#8217;m going to launch with the tests I&#8217;ve got because I know no one will loose money, die or threaten to kill me/people I know based on what I&#8217;ve got in there. </p><p>Here&#8217;s what I&#8217;m going to do instead:</p><p>I&#8217;ve got a second commercial project already cooking in my head&#8230; so I&#8217;m going to solely rely on BDD to build this app&#8230; and learn from that experience.</p><p>In case it hasn&#8217;t been obvious, I recommend you check out Noel Rappin&#8217;s (is that really his last name?) ebook and buy his book when it comes out.</p> ]]></content:encoded> <wfw:commentRss>http://railsnotes.com/76-behavior-driven-development-in-ruby-on-rails/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (user agent is rejected)
Database Caching 6/16 queries in 0.035 seconds using disk

Served from: railsnotes.com @ 2010-09-10 05:05:33 -->