<?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>Google Data &#187; Michelle Levesque</title>
	<atom:link href="/author/michelle-levesque/feed/" rel="self" type="application/rss+xml" />
	<link>https://googledata.org</link>
	<description>Everything Google: News, Products, Services, Content, Culture</description>
	<lastBuildDate>Fri, 10 Apr 2015 22:28:52 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.1.1</generator>
	<item>
		<title>TotT: Naming Unit Tests Responsibly</title>
		<link>https://googledata.org/google-testing/tott-naming-unit-tests-responsibly/</link>
		<comments>https://googledata.org/google-testing/tott-naming-unit-tests-responsibly/#comments</comments>
		<pubDate>Fri, 02 Feb 2007 06:20:00 +0000</pubDate>
		<dc:creator><![CDATA[Michelle Levesque]]></dc:creator>
				<category><![CDATA[Google Testing]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[For a class, try having a corresponding set of test methods, where each one describes a responsibility of the object, with the first word implicitly the name of the class under test. For example, in Java:  class HtmlLinkRewriterTest ... {    void testA...]]></description>
				<content:encoded><![CDATA[<p>For a class, try having a corresponding set of test methods, where each one describes a responsibility of the object, with the first word implicitly the name of the class under test. For example, in Java:</p><blockquote style="background: rgb(255, 255, 224) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy:-moz-initial;"><pre><br />  class HtmlLinkRewriterTest ... {<br />    void testAppendsAdditionalParameterToUrlsInHrefAttributes(){?}<br />    void testDoesNotRewriteImageOrJavascriptLinks(){?}<br />    void testThrowsExceptionIfHrefContainsSessionId(){?}<br />    void testEncodesParameterValue(){?}<br />  }<br /><br /></pre></blockquote><p>This can be read as:</p><blockquote style="background: rgb(255, 255, 224) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><pre> <br />   HtmlLinkRewriter appends additional param to URLs in href attrs.<br />   HtmlLinkRewriter does not rewrite image or JavaScript links.<br />   HtmlLinkRewriter throws exception if href contains session ID.<br />   HtmlLinkRewriter encodes parameter value.   <br /><br /></pre></blockquote><p><br /><b>Benefits</b><br/><p>The tests emphasizes the object's responsibilities (or features) rather than public methods and inputs/output. This makes it easier for future engineers who want to know what it does without having to delve into the code.</p><p>These naming conventions can help point out smells. For example, when it's hard to construct a sentence where the first word is the class under test, it suggests the test may be in the wrong place. And classes that are hard to describe in general often need to be broken down into smaller classes with clearer responsibilities.</p><p>Additionally, tools can be used to help understand code quicker:</p><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_VjOR6dTntqM/RcLZ40kJBWI/AAAAAAAAAAY/81sWQsZX2YY/s1600-h/testdox.png"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://1.bp.blogspot.com/_VjOR6dTntqM/RcLZ40kJBWI/AAAAAAAAAAY/81sWQsZX2YY/s400/testdox.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5026819704305026402" /></a><br /><p>(This example shows a class in IntelliJ with the TestDox plugin giving an overview of the test.)</p><br /><p>Remember to <a href="http://code.google.com/testing/TotT-2007-02-01.pdf">download this episode</a> of Testing on the Toilet, print it, and flyer your office.<br /></p><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15045980-6022614418228891973?l=googletesting.blogspot.com' alt='' /></div>]]></content:encoded>
			<wfw:commentRss>https://googledata.org/google-testing/tott-naming-unit-tests-responsibly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="" length="" type="" />
		</item>
		<item>
		<title>TotT: Better Stubbing in Python</title>
		<link>https://googledata.org/google-testing/tott-better-stubbing-in-python/</link>
		<comments>https://googledata.org/google-testing/tott-better-stubbing-in-python/#comments</comments>
		<pubDate>Thu, 25 Jan 2007 01:11:00 +0000</pubDate>
		<dc:creator><![CDATA[Michelle Levesque]]></dc:creator>
				<category><![CDATA[Google Testing]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[So you've learned all about method stubs, mock objects, and fakes. You might be tempted to stub out slow or I/O-dependent built-ins. For example:  def Foo(path):   if os.path.exists(path):     return DoSomething()   else:     return DoSomethingElse() d...]]></description>
				<content:encoded><![CDATA[<p>So you've learned all about method stubs, mock objects, and fakes. You might be tempted to stub out slow or I/O-dependent built-ins. For example:<br /></p> <blockquote style="background: rgb(255, 255, 224) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><pre><br /><b> def</b> Foo(path):<br /><b>   if</b> <span style="color:blue;">os.path.exists</span>(path):<br /><b>     return</b> DoSomething()<br /><b>   else:</b><br /><b>     return</b> DoSomethingElse()<br /><br /><b> def</b> testFoo(self):         # Somewhere in your unit test class<br />   old_exists = os.path.exists<br />   <b>try</b>:<br />     os.path.exists = <b>lambda</b> x: True<br />     self.assertEqual(Foo('bar'), something)<br />     os.path.exists = <b>lambda</b> x: False<br />     self.assertEqual(Foo('bar'), something_else)<br />   <b>finally</b>:<br />     # Remember to clean-up after yourself!<br />     os.path.exists = old_exists<br /><br /></pre></blockquote><p>Congratulations, you just achieved 100% coverage! Unfortunately, you might find that this test fails in strange ways. For example, given the following <tt>DoSomethingElse</tt> which checks the existence of a different file: </p><blockquote style="background: rgb(255, 255, 224) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><pre><br /><b> def</b> DoSomethingElse():<br /><b>   assert</b> os.path.exists(some_other_file)<br /><b>   return</b> some_other_file<br /><br /></pre></blockquote><p><tt>Foo</tt> will now throw an exception in its second invocation because <tt>os.path.exists</tt> returns False so the assertion fails.</p><p><br />You could avoid this problem by stubbing or mocking out <tt>DoSomethingElse</tt>, but the task might be daunting in a real-life situation.  Instead, it is safer and faster to parameterize the built-in:<br /></p><blockquote style="background: rgb(255, 255, 224) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><pre><br /><b> def</b> Foo(path, path_checker=<span style="color:blue;">os.path.exists</span>):<br /><b>   if</b> path_checker(path):<br /><b>     return</b> DoSomething()<br /><span style="font-weight: bold;">   else</span>:<br /><b>     return</b> DoSomethingElse()<br /><br /><b> def</b> testFoo(self):<br />   self.assertEqual(Foo('bar', <b>lambda</b> x: True), something)<br />   self.assertEqual(Foo('bar', <b>lambda</b> x: False), something_else)<br /><br /></pre></blockquote><p>Remember to <a href="http://code.google.com/testing/TotT-2007-01-22.pdf">download this episode</a> of Testing on the Toilet, print it, and flyer your office.<br /></p><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15045980-6115848053653881183?l=googletesting.blogspot.com' alt='' /></div>]]></content:encoded>
			<wfw:commentRss>https://googledata.org/google-testing/tott-better-stubbing-in-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introducing &quot;Testing on the Toilet&quot;</title>
		<link>https://googledata.org/google-testing/introducing-testing-on-the-toilet/</link>
		<comments>https://googledata.org/google-testing/introducing-testing-on-the-toilet/#comments</comments>
		<pubDate>Sun, 21 Jan 2007 23:12:00 +0000</pubDate>
		<dc:creator><![CDATA[Michelle Levesque]]></dc:creator>
				<category><![CDATA[Google Testing]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[We want you to write more tests. Yes, you. You've already been told that tests are the safety net that protects you when you need to refactor your code, or when another developer adds features. You even know that tests can help with the design of your ...]]></description>
				<content:encoded><![CDATA[<span class="q">We want you to write more tests. Yes, you. You've already been told that tests are the safety net that protects you when you need to refactor your code, or when another developer adds features. You even know that tests can help with the design of your code. <br /><br />But, although you've read the books and heard the lectures, maybe you need a little more inspiration, tips, and prodding.  And you need it to be in a place where when you see it, you can't ignore it.<br /><br />That's where we can help.  We're the "Google Testing Grouplet," a small band of volunteers who are passionate about software testing.<br /><br />We're unveiling the public release of "Testing on the Toilet": one of Google's little secrets that has helped us to inspire our developers to write well-tested code. We write flyers about everything from dependency injection to code coverage, and then regularly plaster the bathrooms all over Google with each episode, almost 500 stalls worldwide.  We've received a lot of feedback about it.  Some favorable ("This is great because I'm always forgetting to bring my copy of Linux Nerd 2000 to the bathroom!") and some not ("I'm trying to use the bathroom, can you folks please just LEAVE ME ALONE?").  Even the <a href="http://www.washingtonpost.com/wp-dyn/content/article/2006/10/20/AR2006102001461.html">Washington Post noticed</a>.<br /><br />We've decided to share this secret weapon with the rest of the world to help spread our passion for testing, and to provide a fun and easy way for you to educate yourself and the rest of your company about these important tricks and techniques.<br /><br />We'll be putting episodes on this blog on a regular basis and providing PDFs so you can print them out and put them up in your own bathrooms, hallways, kitchens, moon bases, secret underground fortresses, billionaire founders' Priuses, wherever. Send your photos and stories to <a href="mailto:TotT@google.com"  onclick="return top.js.OpenExtLink(window,event,this)"> TotT@google.com</a> and let us know how Testing on the Toilet is received at your company.<br /><br />And meanwhile, keep writing those tests.</span><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15045980-3901999204813523959?l=googletesting.blogspot.com' alt='' /></div>]]></content:encoded>
			<wfw:commentRss>https://googledata.org/google-testing/introducing-testing-on-the-toilet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
