<?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>SmartLogic Solutions Blog &#187; TATFT</title>
	<atom:link href="http://blog.smartlogicsolutions.com/category/testing/tatft-testing/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.smartlogicsolutions.com</link>
	<description>News and updates from the people at SmartLogic Solutions</description>
	<lastBuildDate>Tue, 30 Nov 2010 21:39:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Timecop 0.3.4 Released</title>
		<link>http://blog.smartlogicsolutions.com/2009/12/07/timecop-0-3-4-released/</link>
		<comments>http://blog.smartlogicsolutions.com/2009/12/07/timecop-0-3-4-released/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 21:39:06 +0000</pubDate>
		<dc:creator>John Trupiano</dc:creator>
				<category><![CDATA[John Trupiano]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[TATFT]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[rubygem]]></category>
		<category><![CDATA[tatft]]></category>
		<category><![CDATA[timecop]]></category>

		<guid isPermaLink="false">http://blog.smartlogicsolutions.com/?p=794</guid>
		<description><![CDATA[Timecop 0.3.4 has just been released. To install simply run: gem install timecop. Timecop is a RubyGem providing &#8220;time travel&#8221; and &#8220;time freezing&#8221; capabilities, making it dead simple to test time-dependent code. It provides a unified method to mock Time.now, Date.today, and DateTime.now in a single call. Documentation is hosted at RubyForge. The source code [...]]]></description>
			<content:encoded><![CDATA[<p>Timecop 0.3.4 has just been released.  To install simply run: <code>gem install timecop</code>.</p>
<p>Timecop is a RubyGem providing &#8220;time travel&#8221; and &#8220;time freezing&#8221; capabilities, making it dead simple to test time-dependent code.  It provides a unified method to mock Time.now, Date.today, and DateTime.now in a single call.</p>
<p>Documentation is hosted at <a href="http://johntrupiano.rubyforge.org/timecop/">RubyForge</a>.  The source code is hosted at <a href="http://github.com/jtrupiano/timecop">GitHub</a>.</p>
<p>Updates include:</p>
<p><span id="more-794"></span></p>
<p><strong>Maintenance</strong></p>
<ul>
<li>Fix various timezone-related issues.  Notably, when traveling to a DateTime<br />
    instance specified in a non-local timezone, convert provided DateTime<br />
    instance to a local instance and return that from DateTime.now.<br />
    Code contributed by Michaël Witrant [<a href="http://github.com/piglop">piglop</a>]
</li>
<li>Fix bug that would not allow Timecop to be used when Ruby&#8217;s &#8216;date&#8217;<br />
    library had not been previously loaded.<br />
    Code contributed by Tuomas Kareinen [<a href="http://github.com/tuomas">tuomas</a>]
</li>
<li>Fix bug when traveling to a DateTime across a DST boundary that<br />
    resulted in DateTime&#8217;s being off by an hour.
</li>
<li>Migrate argument parsing into Timecop::TimeStackItem to reduce the<br />
    responsibility of the Timecop class.
</li>
</ul>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://blog.smartlogicsolutions.com/2009/09/20/timecop-0-3-0-released/" rel="bookmark" class="crp_title">Timecop 0.3.0 Released</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/12/24/timecop-2-released-freeze-and-rebase-time-ruby/" rel="bookmark" class="crp_title">Timecop 0.2.0 Released: Freeze and Rebase Time in Ruby</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/11/19/timecop-freeze-time-in-ruby-for-better-testing/" rel="bookmark" class="crp_title">Timecop: Freeze Time in Ruby for Better Testing</a></li><li><a href="http://blog.smartlogicsolutions.com/2010/05/13/rack-rewrite-1-0-0-released/" rel="bookmark" class="crp_title">Rack::Rewrite 1.0.0 Released</a></li><li><a href="http://blog.smartlogicsolutions.com/2010/01/06/rack-rewrite-0-2-1-released/" rel="bookmark" class="crp_title">Rack::Rewrite 0.2.1 Released</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://blog.smartlogicsolutions.com/2009/12/07/timecop-0-3-4-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Timecop 0.3.0 Released</title>
		<link>http://blog.smartlogicsolutions.com/2009/09/20/timecop-0-3-0-released/</link>
		<comments>http://blog.smartlogicsolutions.com/2009/09/20/timecop-0-3-0-released/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 03:27:34 +0000</pubDate>
		<dc:creator>John Trupiano</dc:creator>
				<category><![CDATA[John Trupiano]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[TATFT]]></category>
		<category><![CDATA[rubygem]]></category>
		<category><![CDATA[tatft]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[timecop]]></category>

		<guid isPermaLink="false">http://blog.smartlogicsolutions.com/?p=704</guid>
		<description><![CDATA[Timecop 0.3.0 has just been released. To install simply run: gem install timecop. Timecop is a RubyGem providing &#8220;time travel&#8221; and &#8220;time freezing&#8221; capabilities, making it dead simple to test time-dependent code. It provides a unified method to mock Time.now, Date.today, and DateTime.now in a single call. Documentation is on RubyForge. The source code is [...]]]></description>
			<content:encoded><![CDATA[<p>Timecop 0.3.0 has just been released.  To install simply run: <code>gem install timecop</code>.</p>
<p>Timecop is a RubyGem providing &#8220;time travel&#8221; and &#8220;time freezing&#8221; capabilities, making it dead simple to test time-dependent code.  It provides a unified method to mock Time.now, Date.today, and DateTime.now in a single call.</p>
<p>Documentation is on <a href="http://johntrupiano.rubyforge.org/timecop/">RubyForge</a>.  The source code is hosted at <a href="http://github.com/jtrupiano/timecop">GitHub</a>.</p>
<p>Updates include:</p>
<p><strong>API</strong></p>
<ul>
<li>Completely remove Timecop#unset_all (deprecated by Timecop#return in 0.2.0)</li>
<li>Return Time.now from #freeze, #travel and #return  &#8212; code contributed by Keith Bennett (<a href="http://github.com/keithrbennett">keithrbennett</a>)</li>
</ul>
<p><strong>Maintenance</strong></p>
<ul>
<li>Fix bug that left Time#mock_time set in some instances</li>
<li>Upped build dependency to jeweler ~> 1.2.1</li>
<li>Don&#8217;t pollute top-level namespace with classes/constants</li>
</ul>
<p><strong>Documentation</strong></p>
<ul>
<li>Clearer examples in the README, better description in the gemspec</li>
<li>Improve RDoc</li>
</ul>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://blog.smartlogicsolutions.com/2009/12/07/timecop-0-3-4-released/" rel="bookmark" class="crp_title">Timecop 0.3.4 Released</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/12/24/timecop-2-released-freeze-and-rebase-time-ruby/" rel="bookmark" class="crp_title">Timecop 0.2.0 Released: Freeze and Rebase Time in Ruby</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/11/19/timecop-freeze-time-in-ruby-for-better-testing/" rel="bookmark" class="crp_title">Timecop: Freeze Time in Ruby for Better Testing</a></li><li><a href="http://blog.smartlogicsolutions.com/2010/01/06/rack-rewrite-0-2-1-released/" rel="bookmark" class="crp_title">Rack::Rewrite 0.2.1 Released</a></li><li><a href="http://blog.smartlogicsolutions.com/2010/05/13/rack-rewrite-1-0-0-released/" rel="bookmark" class="crp_title">Rack::Rewrite 1.0.0 Released</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://blog.smartlogicsolutions.com/2009/09/20/timecop-0-3-0-released/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>TATFT: Test Private Methods in C++</title>
		<link>http://blog.smartlogicsolutions.com/2009/02/16/tatft-test-private-methods-in-c/</link>
		<comments>http://blog.smartlogicsolutions.com/2009/02/16/tatft-test-private-methods-in-c/#comments</comments>
		<pubDate>Tue, 17 Feb 2009 00:46:43 +0000</pubDate>
		<dc:creator>John Trupiano</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[John Trupiano]]></category>
		<category><![CDATA[TATFT]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://blog.smartlogicsolutions.com/?p=521</guid>
		<description><![CDATA[It&#8217;s very rare that I do any C++ programming these days. However, one of my oldest customers continues to utilize a C++-based optimization/statistics framework that we helped them build many years ago. The project has a wonderful purpose, and we owe quite a bit to some of the first people to trust us (thank you [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s very rare that I do any C++ programming these days.  However, one of my oldest customers continues to utilize a C++-based optimization/statistics framework that we helped them build many years ago.  The project has a <a href="http://jama.ama-assn.org/cgi/content/abstract/293/15/1883">wonderful purpose</a>, and we owe quite a bit to some of the first people to trust us (thank you Sommer and Dorry!).</p>
<p>As a Ruby programmer, I&#8217;ve come to love test-driven programming.  As such, I&#8217;ve made an effort recently to build a test-based workflow into this existing codebase (not always the easiest thing to do, applying a test-base to a large existing codebase).  Today I found myself in dire need of being able to test private functions in C++.  As a testament to the poor state of testing in other programming languages, many message boards/threads simply told me that I was testing the wrong thing (you should test the public API, not the private implementation).  Well, needless to say, this left me a bit uncomfortable.  The fact is, the majority of my code is tucked into private methods, and I&#8217;d be left with huge long-running end-to-end tests if I strictly followed this heuristic.</p>
<p>However, I came across one golden nugget, one of the most clever hacks I&#8217;ve seen in some time.  By utilizing pre-processor directives, we can temporarily override the meaning of private and protected in C++ code, essentially aliasing it to public.</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"> <span style="color: #339900;">#define protected public</span>
 <span style="color: #339900;">#define private   public</span>
 <span style="color: #339900;">#include &quot;TheClassHeaderUnderTest.h&quot;</span>
 <span style="color: #339900;">#undef protected</span>
 <span style="color: #339900;">#undef private</span></pre></div></div>

<p>See what this is doing?  We wrap the class that we&#8217;ll be testing in pre-processor directives to interpret protected and private as an alias for public, essentially loading that class (when including the header file) as entirely public.  This allows me to access everything!  Private methods, private variables, you name it.  And now, just like in Ruby, it&#8217;s no holds barred, allowing me to poke and prod my objects without being wrapped on the wrist by the compiler.</p>
<p>Even better, these directives simply wrap your includes in your test files.  In other words, I don&#8217;t have to change my implementation to achieve this.</p>
<p>A clever hack, no matter the language or technology, is a clever hack.  And I absolutely love this hack.</p>
<p><strong>Credit</strong>: I discovered this technique as a comment on <a href="http://c2.com/cgi/wiki?ExtremeProgrammingTestingPrivateMethods">this wiki</a>.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://blog.smartlogicsolutions.com/2008/07/16/creating-custom-layout-in-flex-4-gumbo/" rel="bookmark" class="crp_title">Creating a Custom Layout Class in Flex 4</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/07/19/creating-custom-flex-4-skinnable-component/" rel="bookmark" class="crp_title">Creating Your First Custom SkinnableComponent in Flex 4</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/08/27/serialization-errorbug-when-using-bytearray-readobject-iexternalizable-class/" rel="bookmark" class="crp_title">Serialization Error/Bug When Using a ByteArray and readObject in an IExternalizable Class?</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/11/19/timecop-freeze-time-in-ruby-for-better-testing/" rel="bookmark" class="crp_title">Timecop: Freeze Time in Ruby for Better Testing</a></li><li><a href="http://blog.smartlogicsolutions.com/2010/10/08/testing-ajax-with-testunit/" rel="bookmark" class="crp_title">Testing AJAX with Test::Unit</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://blog.smartlogicsolutions.com/2009/02/16/tatft-test-private-methods-in-c/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Timecop 0.2.0 Released: Freeze and Rebase Time in Ruby</title>
		<link>http://blog.smartlogicsolutions.com/2008/12/24/timecop-2-released-freeze-and-rebase-time-ruby/</link>
		<comments>http://blog.smartlogicsolutions.com/2008/12/24/timecop-2-released-freeze-and-rebase-time-ruby/#comments</comments>
		<pubDate>Wed, 24 Dec 2008 06:14:35 +0000</pubDate>
		<dc:creator>John Trupiano</dc:creator>
				<category><![CDATA[John Trupiano]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[TATFT]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[jtrupiano]]></category>
		<category><![CDATA[rubygem]]></category>
		<category><![CDATA[tatft]]></category>
		<category><![CDATA[test]]></category>
		<category><![CDATA[timecop]]></category>

		<guid isPermaLink="false">http://blog.smartlogicsolutions.com/?p=445</guid>
		<description><![CDATA[I just released version 0.2.0 of Timecop this evening (morning). The primary feature added was the distinction between &#8220;freezing&#8221; and &#8220;rebasing&#8221; time. In 0.1.0, Timecop.travel would actually freeze time. This is no longer the case. Rather, a time offset will be calculated, and a running clock is simulated by always offsetting the time returned by [...]]]></description>
			<content:encoded><![CDATA[<p>I just released version 0.2.0 of <a href="http://github.com/jtrupiano/timecop">Timecop</a> this evening (morning).</p>
<p>The primary feature added was the distinction between &#8220;freezing&#8221; and &#8220;rebasing&#8221; time.  In 0.1.0, <code>Timecop.travel</code> would actually freeze time.  This is no longer the case.  Rather, a time offset will be calculated, and a running clock is simulated by always offsetting the time returned by Time.now (and friends) by the original offset.</p>
<p>(Note that time can still be frozen with <code>Timecop.freeze</code>.)</p>
<p><span id="more-445"></span></p>
<p>To update a previous version:</p>
<pre><code>sudo gem update timecop</code></pre>
<p>To install for the first time: </p>
<pre><code>sudo gem install timecop</code></pre>
<p>The new feature set allows us to avoid the following common pitfalls that were present in 0.1.0. </p>
<ol>
<li>In rails, if you had set up a time mock in the development environment, then every time you invoked <code>script/generate migration</code> (and others), the generator would read your mocked instance of Time.now, and use that date for the migration name.</li>
<li>Any benchmarking/timing code executed within the yielded block would always return times of 0 seconds.  This was due to time being frozen.</li>
</ol>
<p>The other major change to the API was the deprecating of Timecop.unset_all in favor or Timecop.return.</p>
<p>This update also vastly <a href="http://johntrupiano.rubyforge.org/timecop">improves the rdoc</a>, making the public API much more accessible.  The Timecop class has particularly thorough documentation.</p>
<p>For a more complete description of the gem, please refer to the <a href="http://blog.smartlogicsolutions.com/2008/11/19/timecop-freeze-time-in-ruby-for-better-testing/">introductory blog post</a>.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://blog.smartlogicsolutions.com/2009/09/20/timecop-0-3-0-released/" rel="bookmark" class="crp_title">Timecop 0.3.0 Released</a></li><li><a href="http://blog.smartlogicsolutions.com/2009/12/07/timecop-0-3-4-released/" rel="bookmark" class="crp_title">Timecop 0.3.4 Released</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/11/19/timecop-freeze-time-in-ruby-for-better-testing/" rel="bookmark" class="crp_title">Timecop: Freeze Time in Ruby for Better Testing</a></li><li><a href="http://blog.smartlogicsolutions.com/2010/05/13/directory-conventions-for-rack-middleware-rubygems/" rel="bookmark" class="crp_title">Directory Conventions for Rack Middleware RubyGems</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/12/18/puremvcgen-011-released-now-works-on-windows/" rel="bookmark" class="crp_title">PureMVCGen 0.1.1 Released &#8211; Now Works on Windows</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://blog.smartlogicsolutions.com/2008/12/24/timecop-2-released-freeze-and-rebase-time-ruby/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

