In this Mastering Grails installment, Scott Davis shows you how to take advantage of the built-in mocking capabilities of theGrailsUnitTestCaseandControllerUnitTestCaseclasses included with Grails.
A collection of articles and resources of interest to the modern software developer
Your work is going to fill a large part of your life, and the only way to be truly satisfied is to do what you believe is great work. And the only way to do great work is to love what you do.
-- Steve Jobs
Showing posts with label Mock. Show all posts
Showing posts with label Mock. Show all posts
Sunday, September 25, 2011
Mock testing with Grails | Mastering Grails
Mastering Grails: Mock testing with Grails
Monday, September 19, 2011
Effective Mockito Part 1 | EclipseSource Blog
Effective Mockito Part 1 « EclipseSource Blog
Last week I talked to a fellow developer, Frank Appel, about Mockito. We’ve been using this mocking library for over a year. We both agreed that of all the innovations we’ve tried in the last year or so, Mockito has boosted our coding productivity the most. With this blog series we want to share our experiences with Mockito. You see that I used the word “effective” in the title, and, in this context I want to define “effective” as arriving at clean test and production code as fast as possible.
Tuesday, September 6, 2011
Mocks Aren't Stubs | Martin Fowler
Mocks Aren't Stubs
The term 'Mock Objects' has become a popular one to describe special case objects that mimic real objects for testing. Most language environments now have frameworks that make it easy to create mock objects. What's often not realized, however, is that mock objects are but one form of special case test object, one that enables a different style of testing. In this article I'll explain how mock objects work, how they encourage testing based on behavior verification, and how the community around them uses them to develop a different style of testing.
Making a Mockery of TDD | Virtuous Code
Making a Mockery of TDD | Virtuous Code
I made this gnomic remark on Twitter the other day:
To be a successful mockist, you must dislike mocks.
A lot of people re-tweeted it, so I guess I’m not completely alone in thinking this way.
I should back up a bit. A “mock object”, or “mock”, is a specific kind of test double. It is an object used in a Unit Test which stands in for another object, and carries certain expectations about how what methods will be called, and how they will be called. If the expectations are not met, the test fails. By contrast, other test doubles, such as stubs objects, make no assertions about which methods will be called. This article is specifically about mock objects and mocked methods, which make an assertion about when, how many times, and with what arguments certain collaborator methods will be called.
The term “Mockist” refers to those programmers who use mock objects in their unit tests. There is another camp of programmers, called “Classicist” by Martin Fowler, who eschew mock objects entirely in their tests.
Subscribe to:
Posts (Atom)