Posted by James Mead
Sat, 30 Aug 2008 16:48:00 GMT
Release Notes
- Fixed bug #21465 – expects & stubs should support method names as strings (as well as symbols) or fail fast. Convert all expectation method names to a symbol in case they were supplied as a string.
- By removing Mock#unexpected_method_called we reduce the number of methods vulnerable to the problem that surfaced in bug #21563.
- Fix bug #21563 – stubbing ‘verified?’ method is unsafe. Instance method names on the Mock class should be more obscure.
- Performance improvement. StubbaExampleTest goes twice as fast on my local machine.
- Added primitive performance test to default rake task.
- Fix format of case statements which don’t work in Ruby 1.9 and make others consistent.
- There is no point in running (potentially expensive) checks if configuration is set to allow such checks to fail. This is a relatively quick fix in response to Chris McGrath’s performance problems.
- Fix for bug #21161 – ‘uninitialized constant Deprecation in stubba.rb’.
- It’s more readable to talk about ‘once’ and ‘twice’ rather than ‘1 time’ and ‘2 times’.
- Fix bug #20883 – never should raise when called to prevent follow up errors. Fail fast when there are no matching invokable expectations and handle the stub_everything case sensibly. This might not be entirely backwards compatible, but I think the benefits outweigh the risks. The most likely change is that a test that was already failing will now fail faster, which doesn’t seem so awful.
Posted in mocha_release | Tags mocha, mock, ruby, stub, tdd, testing | no comments
Posted by James Mead
Tue, 02 Jan 2007 17:39:00 GMT
Update:
I’ve just read Aslak’s article again in the cold light of day. I now realise I have put words in his mouth, for which I apologise.
I posted the article late at night after being annoyed by the line on the caboose blog. In hindsight, I should have waited until morning and read it through again (and then not posted it in it’s current form).
Original Article:
In a recent article Aslak Hellesoy seemed to imply one of the differences between RSpec and Test::Unit was that RSpec you could do interaction-based testing using Mock Objects. I don’t think this implication was intentional, but this lack of clarity isn’t helpful to those just getting to grips with automated testing.
As I’m sure Aslak will acknowledge, interaction-based testing has been around a lot longer than RSpec and BDD. Most Ruby mocking frameworks (e.g. FlexMock, Mocha) were originally designed to work with Test::Unit. And as Nat Pryce recently explained ,”Mock Objects is a Technique Not a Technology”.
There is a similarly confusing statement in a recent post from courtenay (of the caboose).
The counter-intuitive thing for you test::unit types is that you set up the expectations before calling the method.
...thus perpetuating the myth that you can’t do interaction-based testing without RSpec.
Today, Martin Fowler published an update to his excellent article “Mocks Aren’t Stubs”. I think he has added clarity by breaking
the old dichotomy of state based testing and interaction based testing into the state/behavior verification dichotomy and the classical/mockist TDD dichotomy.
However, I fear people might incorrectly associate “behavior verification” with BDD.
In a comment on Aslak’s article, David Chelimsky comments that
It helps at the very least by promoting this very conversation. How does it hurt?
I don’t think it hurts to have a debate (about whether BDD is more usefu than TDD), but we should avoid sowing confusion about what makes BDD different from TDD.
Aslak talks about the “BDD buzzword”. Quoting from Wikipedia...
Buzzwords are typically intended to impress one’s audience with the pretense of knowledge. For this reason, they are often universal. They typically make sentences difficult to dispute, on account of their cloudy meaning.
I vote for more clarity and less cloudy meaning.
Tags bdd, behaviour, interaction, mock, objects, rspec, state, tdd, test | 9 comments
Posted by James Mead
Mon, 02 Oct 2006 13:19:00 GMT
It’s good to see that Steve & Nat have resurrected mockobjects.com and are starting to publish new articles. They describe the site as…
About Mock Objects, a technique for improving the design of code within Test-Driven Development.
There are also some new developments in their JMock library.
Tags development, driven, jmock, mocha, mock, object, tdd, test | no comments