...
Camel is a Java library so you can easily wire up tests in whatever unit testing framework you use (JUnit 3.x (deprecated), 4.x, or TestNG). However the Camel project has tried to make the testing of Camel as easy and powerful as possible so we have introduced the following features.
...
Name | Component | Description |
---|---|---|
| Is a standalone Java library letting you easily create Camel test cases using a single Java class for all your configuration and routing without using Spring or Guice for Dependency Injection which which does not require an in-depth knowledge of Spring + SpringTest Spring Test or Guice. Supports JUnit 3.x (deprecated) and JUnit 4.x based tests. | |
| Spring Test together with either XML or Java Config to dependency inject your test classes. Notice Supports JUnit 3.x (deprecated) or JUnit 4.x based tests that bootstrap a test environment using Spring without needing to be familiar with Spring Test. The plain JUnit 3.x/4.x based tests work very similar to the test support classes in camel-test. Also supports Spring Test based tests that use the declarative style of test configuration and injection common in Spring Test. The Spring Test based tests provide feature parity with the plain JUnit 3.x/4.x based testing approach. Notice | |
| Camel 2.10: Provides the ability to do unit testing on blueprint configurations | |
| Uses Guice to dependency inject your test classes | |
Camel TestNG | camel-testng | Supports plain TestNG based tests with or without Spring or Guice for Dependency Injection which does not require an in-depth knowledge of Spring + Spring Test or Guice. Also from Camel 2.10 onwards, this component supports Spring Test based tests that use the declarative style of test configuration and injection common in Spring Test. |
In all approaches the test classes look pretty much the same in that they all reuse the Camel binding and injection annotations.
...
Wiki Markup |
---|
{snippet:lang=java|id=example|url=camel/trunk/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/DebugBlueprintTest.java} |
Also notice the use of getBlueprintDescriptors
to indicate that by default we should look for the camelContext.xml in the package to configure the test case which looks like this
...