<?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>Floehopper: Tag jmock</title>
    <link>http://blog.floehopper.org/articles/tag/jmock?tag=jmock</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>thoughts on the bergy bits of life</description>
    <item>
      <title>Mocha 0.9 Released</title>
      <description>&lt;p&gt;There&amp;#8217;s been quite a bit of work going on in &lt;a href="http://mocha.rubyforge.org"&gt;Mocha&lt;/a&gt; over recent months, but a release is long overdue. The &lt;span class="caps"&gt;API&lt;/span&gt; is now pretty stable and so this release jumps from version 0.5 to 0.9. Much of the work has been refactoring Mocha&amp;#8217;s internals to support new features and make the code more maintainable.&lt;/p&gt;


	&lt;p&gt;Before attempting the refactoring, extensive acceptance tests were added. One of the benefits of this is that it should now be easier to write new acceptance tests if you want to suggest new features or illustrate a bug ;-)&lt;/p&gt;


	&lt;p&gt;Here&amp;#8217;s a quick summary of the changes in the release. I&amp;#8217;ll try to post some code examples here in the near future.&lt;/p&gt;


	&lt;h2&gt;Ordering constraints&lt;/h2&gt;


	&lt;p&gt;Based on the &lt;a href="http://jmock.org/"&gt;JMock&lt;/a&gt; constraints with the same names&amp;#8230;&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;Added &amp;#8220;sequences&amp;#8221; for constraining the order of expected invocations. See &lt;a href="http://mocha.rubyforge.org/classes/Mocha/Standalone.html#M000008"&gt;Standalone#sequence&lt;/a&gt; and &lt;a href="http://mocha.rubyforge.org/classes/Mocha/Expectation.html#M000049"&gt;Expectation#in_sequence&lt;/a&gt;.&lt;/li&gt;
		&lt;li&gt;Added &amp;#8220;states&amp;#8221; for constraining the order of expected invocations. See &lt;a href="http://mocha.rubyforge.org/classes/Mocha/Standalone.html#M000009"&gt;Standalone#states&lt;/a&gt;, &lt;a href="http://mocha.rubyforge.org/classes/Mocha/Expectation.html#M000047"&gt;Expectation#then&lt;/a&gt;, &lt;a href="http://mocha.rubyforge.org/classes/Mocha/Expectation.html#M000048"&gt;Expectation#when&lt;/a&gt; and &lt;a href="http://mocha.rubyforge.org/classes/Mocha/StateMachine.html"&gt;StateMachine&lt;/a&gt;.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;h2&gt;Configurable warnings or errors&lt;/h2&gt;


	&lt;ul&gt;
	&lt;li&gt;When a method on a non-public method is stubbed&lt;/li&gt;
		&lt;li&gt;When a method on a non-existent method is stubbed&lt;/li&gt;
		&lt;li&gt;When a method on a non-mock object is stubbed (partial mocking)&lt;/li&gt;
		&lt;li&gt;When a method is stubbed unnecessarily (i.e. the stubbed method is not called during the test)&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;See &lt;a href="http://mocha.rubyforge.org/classes/Mocha/Configuration.html"&gt;Configuration&lt;/a&gt; for more details.&lt;/p&gt;


	&lt;h2&gt;Improved error messages&lt;/h2&gt;


	&lt;ul&gt;
	&lt;li&gt;A more readable and complete list of unsatisfied expectations, satisfied expectations and state machines.&lt;/li&gt;
		&lt;li&gt;Display more sensible failure message for any_instance expectations.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;h2&gt;Parameter matchers&lt;/h2&gt;


	&lt;ul&gt;
	&lt;li&gt;New to this release: &lt;a href="http://mocha.rubyforge.org/classes/Mocha/ParameterMatchers.html#M000024"&gt;optionally&lt;/a&gt; (allows matching of optional parameters if available), &lt;a href="http://mocha.rubyforge.org/classes/Mocha/ParameterMatchers.html#M000027"&gt;yaml_equivalent&lt;/a&gt; (allows matching of &lt;span class="caps"&gt;YAML&lt;/span&gt; that represents the specified object), &lt;a href="http://mocha.rubyforge.org/classes/Mocha/ParameterMatchers.html#M000026"&gt;responds_with&lt;/a&gt; (tests the quack not the duck).&lt;/li&gt;
		&lt;li&gt;Nesting of matchers is now supported.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;h2&gt;Syntax shortcut&lt;/h2&gt;


	&lt;p&gt;An optional block can be passed into the &lt;a href="http://mocha.rubyforge.org/classes/Mocha/Standalone.html#M000005"&gt;Standalone#mock&lt;/a&gt; method. The block is evaluated in the context of the new mock instance and can be used as a shortcut to set up expectations.&lt;/p&gt;


	&lt;h2&gt;Ruby &amp;#38; Rails compatibility&lt;/h2&gt;


	&lt;p&gt;Tested with Ruby 1.8.4, 1.8.5, 1.8.6 &amp;#38; 1.9. All related bugs and warnings believed to be fixed.&lt;/p&gt;


	&lt;p&gt;Tested with Rails 1.2.3 &amp;#38; Rails 2.1.0.&lt;/p&gt;


	&lt;h2&gt;Deprecation&lt;/h2&gt;


	&lt;p&gt;There is no longer any need to have a &amp;#8220;require &amp;#8216;stubba&amp;#8217;&amp;#8221; statement in your code. A deprecation warning has been added to this effect, because the file will be removed in a future release.&lt;/p&gt;


	&lt;h2&gt;Bug fixes&lt;/h2&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;a href="http://rubyforge.org/tracker/index.php?func=detail&amp;#38;aid=18914&amp;#38;group_id=1917&amp;#38;atid=7477"&gt;18914 in revision 296&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://rubyforge.org/tracker/index.php?func=detail&amp;#38;aid=18917&amp;#38;group_id=1917&amp;#38;atid=7477"&gt;18917 in revision 295&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://rubyforge.org/tracker/index.php?func=detail&amp;#38;aid=18336&amp;#38;group_id=1917&amp;#38;atid=7477"&gt;18336 in revision 287&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://rubyforge.org/tracker/index.php?func=detail&amp;#38;aid=17835&amp;#38;group_id=1917&amp;#38;atid=7477"&gt;17835 in revision 255&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://rubyforge.org/tracker/index.php?func=detail&amp;#38;aid=17412&amp;#38;group_id=1917&amp;#38;atid=7477"&gt;17412 in revision 242&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://rubyforge.org/tracker/index.php?func=detail&amp;#38;aid=15977&amp;#38;group_id=1917&amp;#38;atid=7477"&gt;15977 in revision 198&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://rubyforge.org/tracker/index.php?func=detail&amp;#38;aid=11885&amp;#38;group_id=1917&amp;#38;atid=7477"&gt;11885 in revision 156&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;</description>
      <pubDate>Tue, 24 Jun 2008 19:14:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:22e0bfc7-8cd0-4d92-8e72-81397544c6a1</guid>
      <author>James Mead</author>
      <link>http://blog.floehopper.org/articles/2008/06/24/mocha-0-9-released</link>
      <category>mocha_release</category>
      <category>mocha</category>
      <category>mock</category>
      <category>release</category>
      <category>ruby</category>
      <category>stub</category>
      <category>testing</category>
      <category>jmock</category>
    </item>
    <item>
      <title>About Mock Objects</title>
      <description>&lt;p&gt;It&amp;#8217;s good to see that &lt;a href="http://stevef.truemesh.com/"&gt;Steve&lt;/a&gt; &amp;#38; &lt;a href="http://nat.truemesh.com/"&gt;Nat&lt;/a&gt; have resurrected &lt;a href="http://www.mockobjects.com/"&gt;mockobjects.com&lt;/a&gt; and are starting to publish &lt;a href="http://www.mockobjects.com/2006/09/like-fire-drill.html"&gt;new&lt;/a&gt; &lt;a href="http://www.mockobjects.com/2006/09/mocks-driving-srp-design.html"&gt;articles&lt;/a&gt;. They describe the site as&amp;#8230;&lt;/p&gt;


	&lt;blockquote&gt;
		&lt;p&gt;About Mock Objects, a technique for improving the design of code within Test-Driven Development.&lt;/p&gt;
	&lt;/blockquote&gt;


	&lt;p&gt;There are also some &lt;a href="http://cvs.jmock.codehaus.org/browse/jmock/jmock2"&gt;new developments&lt;/a&gt; in their &lt;a href="http://www.jmock.org/"&gt;JMock&lt;/a&gt; library.&lt;/p&gt;</description>
      <pubDate>Mon, 02 Oct 2006 13:19:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:d05dfdc0-5bd2-415a-b9ee-9bfeeb0bd40e</guid>
      <author>James Mead</author>
      <link>http://blog.floehopper.org/articles/2006/10/02/about-mock-objects</link>
      <category>mock</category>
      <category>object</category>
      <category>tdd</category>
      <category>test</category>
      <category>driven</category>
      <category>development</category>
      <category>jmock</category>
      <category>mocha</category>
    </item>
    <item>
      <title>Google Test Automation &amp;amp; RailsConf Europe</title>
      <description>&lt;p&gt;Last week I was at Google&amp;#8217;s inaugural &lt;a href="http://www.testingreflections.com/node/view/4135"&gt;London Test Automation Conference&lt;/a&gt; where I particularly enjoyed the talk by Adam Connors and &lt;a href="http://joe.truemesh.com/blog/"&gt;Joe Walnes&lt;/a&gt; entitled &amp;#8220;Does my button look big in this? Building Testable &lt;span class="caps"&gt;AJAX&lt;/span&gt; Applications&amp;#8221;.  It should be out on &lt;a href="http://video.google.com/"&gt;Google Video&lt;/a&gt; any day now (as are all the &lt;a href="http://www.google.co.uk/intl/en/events/londontesters/speakers.html"&gt;talks&lt;/a&gt;) and is well worth a look.&lt;/p&gt;


	&lt;p&gt;It was also good to hear from &lt;a href="http://nat.truemesh.com/"&gt;Nat Pryce&lt;/a&gt; and &lt;a href="http://stevef.truemesh.com/"&gt;Steve Freeman&lt;/a&gt; about the &lt;a href="http://cvs.jmock.codehaus.org/browse/jmock/jmock2"&gt;new developments&lt;/a&gt; in &lt;a href="http://www.jmock.org/"&gt;JMock&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;Tomorrow I&amp;#8217;m off to &lt;a href="http://europe.railsconf.org/"&gt;RailsConf Europe&lt;/a&gt;. Should be fun.&lt;/p&gt;


Updates:
	&lt;ul&gt;
	&lt;li&gt;the &lt;span class="caps"&gt;LTAC&lt;/span&gt; talk videos are &lt;a href="http://video.google.com/videosearch?q=london+test+automation+conference"&gt;here&lt;/a&gt; (thanks Ade).&lt;/li&gt;
		&lt;li&gt;the &lt;span class="caps"&gt;LTAC&lt;/span&gt; slides are &lt;a href="http://www.google.co.uk/intl/en/events/londontesters/speakers.html"&gt;here&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;</description>
      <pubDate>Wed, 13 Sep 2006 09:55:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:2d1e1d4c-ea58-4f93-b9c3-38555cedd6a0</guid>
      <author>James Mead</author>
      <link>http://blog.floehopper.org/articles/2006/09/13/google-test-automation-railsconf-europe</link>
      <category>ltac</category>
      <category>railsconf</category>
      <category>jmock</category>
      <category>test</category>
      <category>automation</category>
      <category>google</category>
      <category>ruby</category>
      <category>rails</category>
      <category>conference</category>
      <category>london</category>
    </item>
    <item>
      <title>New Mocha Docs</title>
      <description>&lt;p&gt;Spurred on by &lt;a href="http://glu.ttono.us/articles/2006/09/02/mocking-models#comment-1106"&gt;Thorsten&amp;#8217;s comment&lt;/a&gt; on &lt;a href="http://glu.ttono.us/"&gt;Gluttonous&amp;#8217; blog&lt;/a&gt; and a mention of &lt;a href="http://mocha.rubyforge.org"&gt;Mocha&lt;/a&gt; in the &lt;a href="http://cleanair.highgroove.com/articles/2006/09/03/ruby_on_rails_enterprise_capistrano_mocked_models_class_variables_rest"&gt;Top 5 Rails Stories of the Week&lt;/a&gt;, I&amp;#8217;ve given the Mocha &lt;a href="http://mocha.rubyforge.org"&gt;documentation&lt;/a&gt; a major overhaul.&lt;/p&gt;


	&lt;p&gt;Now the &lt;a href="http://rdoc.sourceforge.net/"&gt;RDoc&lt;/a&gt; only shows the public &lt;span class="caps"&gt;API&lt;/span&gt; which should hopefully improve the signal-to-noise ratio and show how simple it is to use.&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;a href="http://mocha.rubyforge.org/classes/Mocha/AutoVerify.html"&gt;Create traditional mock objects&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://mocha.rubyforge.org/classes/Mocha/MockMethods.html"&gt;Set expectations on traditional mock objects&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://mocha.rubyforge.org/classes/Object.html"&gt;Set expectations on real (non-mock) classes&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://mocha.rubyforge.org/classes/Mocha/Expectation.html"&gt;Make expectations more specific or define behaviour of stub&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;


I&amp;#8217;ve also had a play with &lt;a href="http://coderay.rubychan.de/"&gt;CodeRay&lt;/a&gt; and generated syntax-highlighted examples.
	&lt;ul&gt;
	&lt;li&gt;&lt;a href="http://mocha.rubyforge.org/examples/misc.html"&gt;Quick Start&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://mocha.rubyforge.org/examples/mocha.html"&gt;Traditional mocking&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://mocha.rubyforge.org/examples/stubba.html"&gt;Setting expectations on real (non-mock) classes&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;Good general information on mocking&amp;#8230;&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;a href="http://www.martinfowler.com/articles/mocksArentStubs.html"&gt;Mocks Aren&amp;#8217;t Stubs&lt;/a&gt; by &lt;a href="http://www.martinfowler.com/"&gt;Martin Fowler&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://www.jmock.org/yoga.html"&gt;JMock &amp;#8211; Yoga for your unit tests&lt;/a&gt; by &lt;a href="http://nat.truemesh.com/"&gt;Nat Pryce&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;</description>
      <pubDate>Sun, 03 Sep 2006 18:20:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:d79eed64-175c-4108-887d-e122324a8696</guid>
      <author>James Mead</author>
      <link>http://blog.floehopper.org/articles/2006/09/03/new-mocha-docs</link>
      <category>mocha</category>
      <category>stubba</category>
      <category>test</category>
      <category>testing</category>
      <category>mock</category>
      <category>stub</category>
      <category>jmock</category>
      <category>coderay</category>
      <category>syntax</category>
      <category>highlight</category>
      <category>mocking</category>
      <category>stubbing</category>
      <category>ruby</category>
      <category>rails</category>
    </item>
  </channel>
</rss>
