camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hadrian Zbarcea <hzbar...@gmail.com>
Subject Re: Conceptual 'correctness' of using Camel Unit Tests
Date Thu, 05 May 2011 16:37:15 GMT
Improving testing is a long time pet peeve of mine. I experimented with both junit parallel
tests (works awesome) and with maven 3 multithreaded builds (using -T). Combining both on
a box with one quad core i7 and 16G ram gave me an under 25 min full build and test (except
assembly), but with quite a few issues that can be fixed, but probably only for 3.0 because
they are not backwards compatible.

Are the camel unit tests unit? Unfortunately no. There is however a historic reason for that
(not that it makes it right). Back in the baby days of camel, when there was a focus on EIPs
and new ones were added every week, it seemed like a good idea to automate that. That technique,
because of its simplicity spilled into being used in testing components (and there is some
value in that too, but mostly as an integration test). In the meantime camel holds the record
of a hard to justify 4+ hours build/test. 

I still have hopes to get that improved. Some of the things that need to be done: use a lighter
CamelContext (something like a TestCamelContext) for testing components (that doesn't load
TypeConverters for instance and is much faster), cleanup around jmx (one major reason why
parallel tests are impossible now) and a few other smaller things. Christian is right, the
sheer number of components we have makes the cleanup task quite complicated. There were discussions
about splitting the core and that would help with dividing and conquering this task too. I
believe you will see all these (major) improvements in 3.0, but I don't see it likely to happen
until then.

Cheers,
Hadrian


On May 5, 2011, at 10:49 AM, Christian Schneider wrote:

> Theoretically yes and I know Hadrian was already experimenting with that but we are quite
conservative with that. You can easily have occasional test failures then that take a lot
of time to find and fix.
> 
> Christian
> 
> 
> Am 05.05.2011 15:26, schrieb David Karlsen:
>> Can they be run in parallel - or can modules be run in parallel - that could
>> speed things up.
>> 
>> 2011/5/5 Christian Schneider<christian.schneider@sopera.com>
>> 
>>> I think it is only named wrong. The camel test support is written to
>>> support integration
>>> tests not unit tests.
>>> 
>>> I think it is a very good idea to write real unit tests and integration
>>> tests. The unit tests are extremly fast and give you a first security. Still
>>> the integration tests are very important as many errors can only be spotted
>>> this way.
>>> 
>>> I think at the moment camel uses a quite pragmatic test concept. Each
>>> component comes with unit tests and integration tests. As long as the tests
>>> are fast I think there is no big problem with that.
>>> 
>>> All in all the problem is though that a whole camel build takes aroung 4
>>> hours. So we might really be able to do that better. A problem here is
>>> though the big number of components we have.
>>> 
>>> Christian
>>> 
>>> 
>>> Am 05.05.2011 10:56, schrieb Gert Villemos:
>>> 
>>>  Some would argue that a unit test per definition tests the unit completely
>>>> standalone. Using JUnit this is easy, especially when combined with
>>>> Spring,
>>>> i.e. you can isolate your bean and test each method directly.
>>>> 
>>>> The Camel Junit on the other hand test the unit as part of a camle route.
>>>> Even if the route is very simple such as
>>>> 
>>>> <route>
>>>>   <from uri="direct:in"/>
>>>>   <to uri="bean:myBean"/>
>>>>   <to uri="mock:out"/>
>>>> </route>
>>>> 
>>>> Still, It's testing my bean in a context that is more than just using the
>>>> bean methods.
>>>> 
>>>> The Camel in Action book 'only' list on benefit of using Camel Junit
>>>> tests,
>>>> namely simplification of the unit tests. I would like to hear what the
>>>> rest
>>>> of you do / think.
>>>> 
>>>> - Do you use only Camel Junit tests using routes?
>>>> 
>>>> - Do  you use 'normal' method oriented JUnit tests for low level tests of
>>>> individual methods combined with Camel Unit tests for
>>>> 'component/application' level testing?
>>>> 
>>>> - Do you see a conceptual problem in unit testing using Camel JUnit?
>>>> 
>>>> --
>>>> View this message in context:
>>>> http://camel.465427.n5.nabble.com/Conceptual-correctness-of-using-Camel-Unit-Tests-tp4372286p4372286.html
>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>> 
>>> 
>>> --
>>> Christian Schneider
>>> http://www.liquid-reality.de
>>> 
>>> CXF and Camel Architect
>>> SOPERA - The Application Integration Division of Talend
>>> http://www.talend.com
>>> 
>>> 
>> 
> 
> 
> -- 
> Christian Schneider
> http://www.liquid-reality.de
> 
> CXF and Camel Architect
> SOPERA - The Application Integration Division of Talend
> http://www.talend.com
> 


Mime
View raw message