You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by mehdi houshmand <me...@gmail.com> on 2010/11/19 17:08:02 UTC
Mocking a test
Hi,
I've been working on unit testing some of the classes in FOP and I
think FOP could benefit from using a mocking framework. The goal is
obviously that every class has a complimentary test class to test
behaviour and state and mocking a class is a good way to emulate an
object. I shan't make this into a lecture on the benefits, I've
enclosed a good URL as to some of the benefits, but I wanted to put it
to the community for feedback. This would mean including an extra
JAR(s) file in the libs/ directory (obviously we'll have to be careful
with licenses), but I'm just floating the idea if anyone has any
preferred frameworks please do suggest pros/cons.
http://martinfowler.com/articles/mocksArentStubs.html
Thanks
Mehdi
Re: Mocking a test
Posted by Peter Hancock <pe...@gmail.com>.
Hi,
I have played with Mockito too, and found it very intuitive to use in
contrast to EasyMock. Test are easier to understand and maintain when
there intention is not obscured by complicated and verbose setup code,
and api calls to mocking frameworks are often a major source of this
problem. Mockito seems to stay out the way as much as possible,
whilst being powerful enough to fulfil complicated mocking
requirements.
I have only ever tried out Mockito and EasyMock and so my support for
Mockito is not based on that much experience, however Mockito does
seem to be popular choice at the moment, is an active project and
quite mature (though younger than EasyMock, JMock). I would certainly
back the inclusion of Mockito into FOP.
Pete
On Sat, Nov 20, 2010 at 12:58 AM, Adrian Cumiskey
<ad...@gmail.com> wrote:
> Hi Medhi,
>
> That's a great suggestion. I really like to use the Mockito (http://code.google.com/p/mockito/) framework in my tests, it has a fluent interface that is really easy and comfortable to work with.
>
> Adrian.
>
> Sent from my iPad
>
> On Nov 20, 2010, at 12:08 AM, mehdi houshmand <me...@gmail.com> wrote:
>
>> Hi,
>>
>> I've been working on unit testing some of the classes in FOP and I
>> think FOP could benefit from using a mocking framework. The goal is
>> obviously that every class has a complimentary test class to test
>> behaviour and state and mocking a class is a good way to emulate an
>> object. I shan't make this into a lecture on the benefits, I've
>> enclosed a good URL as to some of the benefits, but I wanted to put it
>> to the community for feedback. This would mean including an extra
>> JAR(s) file in the libs/ directory (obviously we'll have to be careful
>> with licenses), but I'm just floating the idea if anyone has any
>> preferred frameworks please do suggest pros/cons.
>>
>> http://martinfowler.com/articles/mocksArentStubs.html
>>
>> Thanks
>>
>> Mehdi
>
Re: Mocking a test
Posted by Adrian Cumiskey <ad...@gmail.com>.
Hi Medhi,
That's a great suggestion. I really like to use the Mockito (http://code.google.com/p/mockito/) framework in my tests, it has a fluent interface that is really easy and comfortable to work with.
Adrian.
Sent from my iPad
On Nov 20, 2010, at 12:08 AM, mehdi houshmand <me...@gmail.com> wrote:
> Hi,
>
> I've been working on unit testing some of the classes in FOP and I
> think FOP could benefit from using a mocking framework. The goal is
> obviously that every class has a complimentary test class to test
> behaviour and state and mocking a class is a good way to emulate an
> object. I shan't make this into a lecture on the benefits, I've
> enclosed a good URL as to some of the benefits, but I wanted to put it
> to the community for feedback. This would mean including an extra
> JAR(s) file in the libs/ directory (obviously we'll have to be careful
> with licenses), but I'm just floating the idea if anyone has any
> preferred frameworks please do suggest pros/cons.
>
> http://martinfowler.com/articles/mocksArentStubs.html
>
> Thanks
>
> Mehdi