2008/9/7 Claus Ibsen <[EMAIL PROTECTED]>: > Hi > > I am writing on another tutorial and is showing how to use plain spring test > support classes for easier junit testing. And the spring .jars is real jars > (not test-jar).
Awesome! > I am thinking that we should for Camel 2.0 also create a real camel-test > component that holds the test support classes end-users and camel itself can > use for unit testing. > > Now these test support classes is mixed with the unit test classes themselves. To be honest, I think lots of that testing code can be retired over time and replaced with the neater new spring stuff really. Or to say that another way; I'm not sure how much code we really need to do testing other than using the nice injection stuff & MockEndpoints with the spring-test stuff. Though we could do with something to test non-spring I guess (maybe Guice?). I did start the camel-hamcrest module with the intention of adding extensions to the hamcrest testing mechanism so you can kinda write assertions using a kinda Java DSL that is self commenting; so when the assertion fails you get great error messages. Am sure we could do better in that area maybe. > Then end users can just depend on camel-test in their maven repo and it's a > more elegant. Also the camel-test.jar will not be cluttered with all kind of > leftovers from our unit tests. For instance log4j.properties, jndi.properties > and whatnot we have got have there. > > Any thoughts? Agreed. Maybe to start with we should ponder if folks use spring and the spring testing stuff http://activemq.apache.org/camel/spring-testing.html what else to we really need? > I think it's a good idea to get in Camel 2.0 from the start before the API > and what else is locked. Then instead of relying on camel-spring test-jar or > camel-core test-jar then end-users should migrate by switching to camel-test. > > Is there any problem if camel-test will support both plain java tests or the > spring ones as well? I've always tried to keep camel-core free of any spring dependencies as there are numerous IoC frameworks folks tend to like; though spring is the most common one folks use. So I guess being spring dependent is no biggie. Though we might wanna do a Guice one too :) The base classes for things like ContextTestSupport is handy if you're not using spring though. But I think the IoC/spring-test approach is a bit cleaner and avoids having to extend from camel specific base classes for tests etc. If using JUnit 4 or TestNG there's no need for a base class at all -- James ------- http://macstrac.blogspot.com/ Open Source Integration http://open.iona.com
