<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
	>
<channel>
	<title>Comments on: Testing in Rails: Part 1 - Unit Testing in Ruby</title>
	<atom:link href="http://www.nullislove.com/2007/11/14/testing-in-rails-part-1-unit-testing-in-ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nullislove.com/2007/11/14/testing-in-rails-part-1-unit-testing-in-ruby/</link>
	<description>Code for Coders</description>
	<pubDate>Thu, 11 Mar 2010 02:52:49 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Why does running a Test::unit test in irb work so weirdly? &#124; keyongtech</title>
		<link>http://www.nullislove.com/2007/11/14/testing-in-rails-part-1-unit-testing-in-ruby/comment-page-1/#comment-1352</link>
		<dc:creator>Why does running a Test::unit test in irb work so weirdly? &#124; keyongtech</dc:creator>
		<pubDate>Sun, 18 Jan 2009 16:30:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.nullislove.com/2007/11/14/testing-in-rails-part-1-unit-testing-in-ruby/#comment-1352</guid>
		<description>[...] I have found this problem mentioned by others. For an example, see this tutorial about testing:  http://www.nullislove.com/2007/11/14...sting-in-ruby/  &gt;irb --simple-prompt &gt;&gt; require 'test/unit' =&gt; true &gt;&gt; class FirstTests &lt; [...]</description>
		<content:encoded><![CDATA[<p>[...] I have found this problem mentioned by others. For an example, see this tutorial about testing:  <a href="http://www.nullislove.com/2007/11/14...sting-in-ruby/" rel="nofollow">http://www.nullislove.com/2007/11/14&#8230;sting-in-ruby/</a>  &gt;irb &#8211;simple-prompt &gt;&gt; require &#8216;test/unit&#8217; =&gt; true &gt;&gt; class FirstTests &lt; [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Richard OnRails</title>
		<link>http://www.nullislove.com/2007/11/14/testing-in-rails-part-1-unit-testing-in-ruby/comment-page-1/#comment-1207</link>
		<dc:creator>Richard OnRails</dc:creator>
		<pubDate>Fri, 11 Jul 2008 00:33:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.nullislove.com/2007/11/14/testing-in-rails-part-1-unit-testing-in-ruby/#comment-1207</guid>
		<description>Hi Kevin,

&gt; at this point both first method and second method are defined and neither has been called

Excellent (subtle) point.  Thanks again for your response and for pointing me to your tutorial as well.

Best wishes,
Richard</description>
		<content:encoded><![CDATA[<p>Hi Kevin,</p>
<p>&gt; at this point both first method and second method are defined and neither has been called</p>
<p>Excellent (subtle) point.  Thanks again for your response and for pointing me to your tutorial as well.</p>
<p>Best wishes,<br />
Richard</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin Skoglund</title>
		<link>http://www.nullislove.com/2007/11/14/testing-in-rails-part-1-unit-testing-in-ruby/comment-page-1/#comment-1205</link>
		<dc:creator>Kevin Skoglund</dc:creator>
		<pubDate>Thu, 10 Jul 2008 19:38:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.nullislove.com/2007/11/14/testing-in-rails-part-1-unit-testing-in-ruby/#comment-1205</guid>
		<description>@Richard: All test methods are being defined inside of a class.  So they are all defined before being called&#8212;meaning before Test::Unit::TestCase runs the tests.  Try wrapping your example in a Ruby class to see.  Here's an example to make the point.

[cc lang="ruby"]
&gt; class SomeClass
&gt;   def first_method
&gt;     second_method
&gt;   end
&gt; 
&gt;   def second_method
&gt;     puts "Hello"
&gt;   end
&gt; end
=&gt; nil

# at this point both first method and second method are defined and neither has been called

&gt; sc = SomeClass.new
&gt; sc.first_method
=&gt; Hello
[/cc]

</description>
		<content:encoded><![CDATA[<p>@Richard: All test methods are being defined inside of a class.  So they are all defined before being called&mdash;meaning before Test::Unit::TestCase runs the tests.  Try wrapping your example in a Ruby class to see.  Here&#8217;s an example to make the point.</p>
<div class="codecolorer-container ruby vibrant" style="overflow:auto;white-space:nowrap;width:620px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br /></div></td><td><div class="ruby codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="sy0">&gt;</span> <span class="kw1">class</span> SomeClass<br />
<span class="sy0">&gt;</span> &nbsp; <span class="kw1">def</span> first_method<br />
<span class="sy0">&gt;</span> &nbsp; &nbsp; second_method<br />
<span class="sy0">&gt;</span> &nbsp; <span class="kw1">end</span><br />
<span class="sy0">&gt;</span> <br />
<span class="sy0">&gt;</span> &nbsp; <span class="kw1">def</span> second_method<br />
<span class="sy0">&gt;</span> &nbsp; &nbsp; <span class="kw3">puts</span> <span class="st0">&quot;Hello&quot;</span><br />
<span class="sy0">&gt;</span> &nbsp; <span class="kw1">end</span><br />
<span class="sy0">&gt;</span> <span class="kw1">end</span><br />
<span class="sy0">=&gt;</span> <span class="kw2">nil</span><br />
<br />
<span class="co1"># at this point both first method and second method are defined and neither has been called</span><br />
<br />
<span class="sy0">&gt;</span> sc = SomeClass.<span class="me1">new</span><br />
<span class="sy0">&gt;</span> sc.<span class="me1">first_method</span><br />
<span class="sy0">=&gt;</span> Hello</div></td></tr></tbody></table></div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Richard OnRails</title>
		<link>http://www.nullislove.com/2007/11/14/testing-in-rails-part-1-unit-testing-in-ruby/comment-page-1/#comment-1204</link>
		<dc:creator>Richard OnRails</dc:creator>
		<pubDate>Thu, 10 Jul 2008 17:12:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.nullislove.com/2007/11/14/testing-in-rails-part-1-unit-testing-in-ruby/#comment-1204</guid>
		<description>Well written tutorial.  I have one question:

Why don't the references to reverse_array fail,  since that method's def had not been seen at those points?  For example, I get "undefined reference ..." from the following when running ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]:

say1()

def say1()
  puts "I'm 1"
end</description>
		<content:encoded><![CDATA[<p>Well written tutorial.  I have one question:</p>
<p>Why don&#8217;t the references to reverse_array fail,  since that method&#8217;s def had not been seen at those points?  For example, I get &#8220;undefined reference &#8230;&#8221; from the following when running ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]:</p>
<p>say1()</p>
<p>def say1()<br />
  puts &#8220;I&#8217;m 1&#8243;<br />
end</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin Skoglund</title>
		<link>http://www.nullislove.com/2007/11/14/testing-in-rails-part-1-unit-testing-in-ruby/comment-page-1/#comment-1039</link>
		<dc:creator>Kevin Skoglund</dc:creator>
		<pubDate>Fri, 22 Feb 2008 23:41:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.nullislove.com/2007/11/14/testing-in-rails-part-1-unit-testing-in-ruby/#comment-1039</guid>
		<description>A single test case will cease execution when it encounters a failure.  It will then move on to the next test case.

So in the "test_subtraction" example above, it will never run the test "assert(1 - 1 == 0)" because the test on the line before it fails.  But it will move on and try to run the other test definitions like "test_addition".</description>
		<content:encoded><![CDATA[<p>A single test case will cease execution when it encounters a failure.  It will then move on to the next test case.</p>
<p>So in the &#8220;test_subtraction&#8221; example above, it will never run the test &#8220;assert(1 - 1 == 0)&#8221; because the test on the line before it fails.  But it will move on and try to run the other test definitions like &#8220;test_addition&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://www.nullislove.com/2007/11/14/testing-in-rails-part-1-unit-testing-in-ruby/comment-page-1/#comment-1035</link>
		<dc:creator>John</dc:creator>
		<pubDate>Thu, 21 Feb 2008 20:55:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.nullislove.com/2007/11/14/testing-in-rails-part-1-unit-testing-in-ruby/#comment-1035</guid>
		<description>"Tests cease execution when they encounter a failure."

I just ran this using Rails.  It seemed to run all my tests catching multiple failures.

Does this make sense?  Does Rails modify testing.

Thanks,

John</description>
		<content:encoded><![CDATA[<p>&#8220;Tests cease execution when they encounter a failure.&#8221;</p>
<p>I just ran this using Rails.  It seemed to run all my tests catching multiple failures.</p>
<p>Does this make sense?  Does Rails modify testing.</p>
<p>Thanks,</p>
<p>John</p>
]]></content:encoded>
	</item>
</channel>
</rss>
