About the author

Steven HarmanSteven Harman is a passionate developer who believes that writing great software isn't just a job, its a craft.

ASP.NET MVP

For recent posts and more about me, scroll to the bottom.

Subscribe

  • Subscribe to my feed. via RSS
  • Subscribe via email via email

News

devLINK Technical Conference

Jobs

Badges

  • Subtext Project
  • Support Subtext
  • HiddenNetwork.com Banner

Rhino.Mocks Beta Bits are Running Turbo-Charged!

A few weeks ago Oren (known to many as Ayende Rahien) pushed out a Rhino.Mocks beta drop so we could take a look at the new Arrange/Act/Assert syntax being cooked up for the pending 3.5 release. Yesterday I finally upgraded my client project to the 3.5 beta bits and started digging into the new syntax.

AAA, FTW!

After using Arrange/Act/Assert for just a day or two I’m already hooked. It feels like a much more natural fit for bdd-style tests.

The whole Given, Expect, When, Then, go-back-and-verify-expectations flow always felt clumsy and counterintuitive, and AAA allows for a more natural Given, When, Then, Verify Expectations.

If that doesn’t make a whole lot of sense, don’t worry… I’m planning a follow-up post to dive a bit deeper and hopefully illustrate the point. For now though, I’d encourage you to go take a look at the Rhino.Mocks tests to get a feel for what you can do with the AAA syntax.

Faster is better…

Aaron Jensen did some digging and was able to speed up performance by a pretty noticeable amount – nearly 50% according to his measurements.

And not that I don’t trust Aaron’s measuring abilities or something, but I decided to do some measuring of my own. I upgraded a current client project and I can confirm, these Rhinos are turbo-charged!

These Rhinos are cookin'!I ran our UnitTests project, which at the time had 1566 tests with none of hitting a database, external resource, etc…, but a majority of them do rely pretty heavily on mocks.

I wasn’t nearly as scientific as Aaron. In fact I was straight-up lazy, running the test project using the most handy mechanism at my disposal - TestDriven.net.

I did a few runs using Rhino.Mocks 3.4 (test runs #1 and 2 in the above picture) and then a couple more with 3.5 (runs #3 and 4). And my totally unscientific results showed… drum roll please… the new bits to be about 50% faster. Sweet!

kick it on DotNetKicks.com

Technorati Tags: , ,

What others are saying.

# Rhino.Mocks Beta Bits are Running Turbo-Charged!
Gravatar DotNetKicks.com
Jun 11, 2008
You've been kicked (a good thing) - Trackback from DotNetKicks.com
# re: Rhino.Mocks Beta Bits are Running Turbo-Charged!
Gravatar Aaron Jensen
Jun 11, 2008
To be clear, the more mocks you use, the more improvement you see. The cost of creating an individual mock goes up linearly, so the cost of creating mocks goes up exponentially. You won't see any improvement if you only ever mock one class, but if you mock 1000, you'll see plenty :)
# re: Rhino.Mocks Beta Bits are Running Turbo-Charged!
Gravatar Steven Harman
Jun 11, 2008
Ahh, yes... good info Aaron!

The project I ran my timings against is a real world application - we're using WinForms and a MVP-ish pattern, so we lean pretty heavily on the idea of fake it till you can make it. So we are creating a lot of different mocks in those 1500+ tests.

I guess the thing I was trying to get across is that its not just in contrived, best-case examples that the speed-up occurs. Its also being seen in the wild.

Thanks again for digging in and helping the cause!
# re: Rhino.Mocks Beta Bits are Running Turbo-Charged!
Gravatar Stephen Rylander
Jun 11, 2008
Rhinomocks...this community is strong. What is the best way to get started with it?
# Big natural boobs movies.
Big black boobs movies of sierra at boobvision. Big natural boobs movies. Free movies on big boobs. Free big natural boobs movies. Big boobs shemales movies. Big boobs free movies.

What do you have to say?

Title*
Name*
Email (never displayed)
(will show your gravatar)
Url
Comment*  
Please add 1 and 2 and type the answer here: