12 February 2008

New Tutorial at QCon

On Tuesday 11th March, at QCon London, Romilly Cocking and I will be running a new tutorial we're developing with Nat Pryce on Test-Driven Development with Mock Objects following on from a successful first run at the last XpDay. Sign up soon!

Labels:


21 November 2007

MockObjects in Bangalore

I'll be presenting a tutorial/workshop/Dojo on TDD with Mock Objects at Agile India in Bangalore this Sunday. I hope the locals will find the material interesting (and that they give me an easy ride while I struggle with the jet lag :).

Labels:


19 October 2007

"Testing towards A Specification: A Systematic Approach"

Peter Dimov has published his Master's thesis. To quote him:

It is based on Test Driven Development with Mock Objects, hence the focus is on interaction-based testing. I'm introducing the mocking framework CalitkoMocks, which is specially designed to provide a notation for writing tests that can be mapped one-to-one to sequence diagrams. Sequence diagrams are classically used to specify object-oriented software systems, however, it is obvious that just a bunch of diagrams representing individual cases cannot really be regarded as a specification. To address this point, I'm also presenting a few test refactorings which help to extract test scenarios (i.e. generalized test cases), which are more suitable to use as a specification.

He's implemented a mock framework for C++ that's part of Calitko

I especially liked his closing remark

After I drew the diagram corresponding to my test, I decided to try to write a test corresponding one-to-one to the sequence diagram. The sequence diagram showed the calls to my stub objects but my test didn’t (because the implementation invoked them implicitly). I ended up writing smarter versions of my stubs which eventually evolved into mocks. Though I had already read about mocks at that time, I didn’t quite get it what kind of beasts these were. It was only after I reinvented the mock that I truly understood the concept.

Perhaps this is a step on the way to addressing Jason Gorman's concerns.

Labels: , , ,


16 October 2007

XpDay London 19/20 November

We have a couple of sessions at XpDay London. Steve will be giving our Synaesthesia talk on Monday. On Tuesday, Nat, with Romily Cocking, Andy Pols, and Steve (part-time) will be giving an introductory tutorial on TDD with Mocks. Book soon!

Labels: ,


23 August 2007

GTAC. Google Test Automation Conference

I'm at Google's Test Automation Conference in New York City (my old stamping ground from the '80's) and so far Mocks have been doing quite well. We had several mentions on his slides from Patric Copeland (Director of QA at Google).

There was also a presentation from Matt Heuser and Sean McMillan, "Examining Interaction-Based testing". I admit I feared a hatchet job but, actually, they presented a very balanced view. They had some good examples of Interaction Testing gone wrong, such as mocking out production code and not writing integration tests. They also pointed out the benefits of using TDD with mocks, including ending up with good code quality statistics implying good maintainability.

The one comment I had on the talk was to de-emphasise use of mocks to speed up unit test runs by mocking external (slow) resources. Our preference is to use mocks within our domain code but to try to write focussed integration tests at the outer boundaries of the system.

Labels:


15 June 2007

Making a point in IEEE Software

IEEE Software We've had a position published (with Joshua Kerievsky on the other side) in the May/June issue of IEEE Software. To quote the abstract:
Point Argument: Mock Objects: Find Out Who Your Friends Are, by Steve Freeman and Nat Pryce. Mock objects help guide object-oriented programming by concentrating on what objects do, no what they are. Counterpoint Argument: TDD: Don't Much It Up with Too Many Mocks, by Joshua Kerievsky. Routinely test-driving code with mock objects leads to premature object composition, hard-to-read and fragile code, and lost time. This department is part of a special issue on test-driven development.
It looks like you have to pay (or get a copy of the magazine) to get the content. I'll ask if we can post our chunk. (thanks to the people who pointed out that you can download a different issue of the journal).

Labels:


21 May 2007

Apache Camel

The Apache ActiveMQ project has recently released Camel, a rule based routing and mediation engine for building enterprise integration systems. Camel provides a DSL-style Java API, inspired by jMock and LiFT, to specify rules for routing, transforming and monitoring messages and you can use mock message receivers to describe and verify expected message flows in tests.

Labels: ,


01 April 2007

Announcing the commons.testing and commons.mocking APIs

For many years years JUnit was the only framework that Java programmers could use for writing tests. However, Java now has a plethora of test frameworks to choose from, JUnit 3, JUnit 4 and TestNG being the three most popular. Likewise for mock objects developers can choose between jMock 1, jMock 2 or EasyMock.

This variety is a problem if you need to run tests that have been written for different frameworks or write tests that need to be run in different frameworks.

To solve this we will soon release two new projects, commons.testing and commons.mocking, which will provide a common, framework-agnostic API for writing tests and using mock objects. Developers will be able to write to a single API and then select a test framework and mock object library to execute the tests at runtime by annotating their tests with the commons.testing annotations, writing a few dozen lines of XML configuration, setting system property and calling the CommonsTestingDOMConfigurator in each test fixture set-up. The commons.testing and commons.mocking frameworks will run be able to run the tests with JUnit 3, JUnit 4 or TestNG and, if you use mock objects, jMock 1, jMock 2 or EasyMock, with no change to the test code at all! The APIs are extensible: by writing to the commons.testing SPI you can add support for more testing or mocking frameworks.

Furthermore, commons.testing can run tests that are defined entirely by XML configuration files instead of complex Java code. This will enable IT departments to greatly reduce the cost of pair programming and test driven development by having lower-cost, non-technical staff author the test cases that specify what the developers must implement in Java.

Watch this space for further annnouncements...

Update: Looks like similar things are happening in the .Net world. See this announcement of an Enterprise Mocking Block.

To the person who posted a comment, we have to admit that this was an April Fools proposal

Labels: ,


28 March 2007

jMock 2.0.0 RC1 released

We've released a Release Candidate for jMock 2.0.0, which includes our new syntax for specifying exceptions. There's a new look web site to go with it which describes the new features. Please take a look.

Labels: ,


21 February 2007

Conferences coming up

Labels:


30 January 2007

Archive links fixed

After some fiddling around with Blogger, I've finally understood what their options for archiving mean. The links should work now.

Labels:


© The authors