Discussion about mock framework ...

Hi, I whould like to introduce a mock framework in logback-extensions and discuss about which one is the best for this project: My preferees are (in this order): - http://code.google.com/p/jmockit/ - http://code.google.com/p/mockito/ Regards Christian

On Fri, Jun 15, 2012 at 6:42 PM, Christian Trutz <christian.trutz@belaso.de>wrote:
Hi,
I whould like to introduce a mock framework in logback-extensions and discuss about which one is the best for this project:
My preferees are (in this order):
- http://code.google.com/p/jmockit/ - http://code.google.com/p/mockito/
Good idea. Also check out PowerMock: http://code.google.com/p/powermock/

Joern Huxhorn wrote a few logabck tests using easymock [1]. I don't really know the easymock API but the little I know I don't like that much. If someone is at ease using one mock API or another, let that person hack away with API he/she prefers. So imho if Christian likes jmockit, by all means let him write tests in jmockit. Similarly, if Tony prefers powermock, let him use that. If later a winner emerges, we'll pick the winner. Of course, if we come to an agreement on a single API, that's cool too. [1] http://www.easymock.org/ -- Ceki http://twitter.com/#!/ceki On 16.06.2012 01:20, Tony Trinh wrote:
On Fri, Jun 15, 2012 at 6:42 PM, Christian Trutz <christian.trutz@belaso.de <mailto:christian.trutz@belaso.de>> wrote:
Hi,
I whould like to introduce a mock framework in logback-extensions and discuss about which one is the best for this project:
My preferees are (in this order):
- http://code.google.com/p/jmockit/ - http://code.google.com/p/mockito/
Good idea. Also check out PowerMock: http://code.google.com/p/powermock/

EasyMock seems to be loosing momentum in favour to Mockito (at least according to Google Trends and SO questions). Moreover AFAIK PowerMock is an extension to existing frameworks (namely EasyMock and Mockito are supported), not a framework on its own. I would actually suggest using one mocking framework for the whole Logback umbrella. Otherwise maintaining someone else's tests with mocking framework we are unfamiliar with becomes painful. Talking about testing, some time ago I added FEST assertions [1] to Logback, I encourage everyone to use it, library provides very nice fluent Java API for assertions: assertThat(age).isEqualTo(20); assertThat(list).hasSize(4); [1]: http://docs.codehaus.org/display/FEST/Fluent+Assertions+Module On 17.06.2012 13:51, ceki wrote:
Joern Huxhorn wrote a few logabck tests using easymock [1]. I don't really know the easymock API but the little I know I don't like that much. If someone is at ease using one mock API or another, let that person hack away with API he/she prefers. So imho if Christian likes jmockit, by all means let him write tests in jmockit. Similarly, if Tony prefers powermock, let him use that. If later a winner emerges, we'll pick the winner. Of course, if we come to an agreement on a single API, that's cool too.
pozdrowienia -- Tomasz Nurkiewicz http://nurkiewicz.blogspot.com

Hi Tomasz, hi all, i introduce the JMockIt framework to logback-extensions [1] because only with this framework I can entirely mock out the whole MongoDB API and reach for example for MongoDBAppenderBase a 100% unit test coverage, without integration tests. Christian [1] https://github.com/qos-ch/logback-extensions/commit/6607b23249abd3b014d79dff... 2012/6/17 Tomasz Nurkiewicz <nurkiewicz@gmail.com>
EasyMock seems to be loosing momentum in favour to Mockito (at least according to Google Trends and SO questions). Moreover AFAIK PowerMock is an extension to existing frameworks (namely EasyMock and Mockito are supported), not a framework on its own.
I would actually suggest using one mocking framework for the whole Logback umbrella. Otherwise maintaining someone else's tests with mocking framework we are unfamiliar with becomes painful.
Talking about testing, some time ago I added FEST assertions [1] to Logback, I encourage everyone to use it, library provides very nice fluent Java API for assertions:
assertThat(age).isEqualTo(20); assertThat(list).hasSize(4);
On 17.06.2012 13:51, ceki wrote:
Joern Huxhorn wrote a few logabck tests using easymock [1]. I don't really know the easymock API but the little I know I don't like that much. If someone is at ease using one mock API or another, let that person hack away with API he/she prefers. So imho if Christian likes jmockit, by all means let him write tests in jmockit. Similarly, if Tony prefers powermock, let him use that. If later a winner emerges, we'll pick the winner. Of course, if we come to an agreement on a single API, that's cool too.
pozdrowienia
-- Tomasz Nurkiewicz http://nurkiewicz.blogspot.com
______________________________**_________________ logback-dev mailing list logback-dev@qos.ch http://mailman.qos.ch/mailman/**listinfo/logback-dev<http://mailman.qos.ch/mailman/listinfo/logback-dev>
participants (4)
-
ceki
-
Christian Trutz
-
Tomasz Nurkiewicz
-
Tony Trinh