Mocks for Speed

Posted by kev Wed, 30 Aug 2006 19:36:00 GMT

I’m starting to come around on the subject of using mock objects as opposed to just letting the code run. Here’s why:

Loaded suite UnitTests
Started
.....................................................
.....................................................
.....................................................
.....................................................
Finished in 0.070892 seconds.

212 tests, 250 assertions, 0 failures, 0 errors
Loaded suite IntegrationTests
Started
...................
Finished in 0.046002 seconds.

19 tests, 24 assertions, 0 failures, 0 errors
Loaded suite AcceptanceTests
Started
...............
Finished in 0.007645 seconds.

This is from the tests that are bundled with Mocha, a mocking library.

Look at those numbers! Look at just the unit tests. 212 tests, 250 assertions, 0.070892 seconds. Hot damn. Imagine your Rails tests running like that.

Posted in ,

Comments are disabled