A common way of testing routes is to use JUnit. Fuse IDE includes a wizard that simplifies creating a JUnit test case for your routes. The wizard will generate the starting point code and configuration to run the test.
To create a new JUnit test case for your route:
Select any item in your routing project from the Project Explorer.
Open the context menu.
Select
| .The New Camel JUnit Test Case wizard opens.
Tip If the New wizard filter. Camel Test Case is under Fuse IDE.
option is not in the menu, you can find it by selecting | to open theIn the Source folder field, enter a location for test case's source code.
Tip The
button opens the Eclipse project explorer dialog.In the Package field, enter a package name for the generated test code.
Tip The
button opens the Eclipse package explorer dialog.In the Camel XML file under test field, enter the name of the Apache Camel context file containing the route to be tested.
Tip The
button opens the Eclipse project explorer dialog.In the Name field, enter a name for the generated test class.
Select the method stubs you want included in the generated code.
If you want to add the default generated comments added to the generated code, check the Generate comments box.
Click
.The Test Endpoints page appears.
In the Available endpoints list, select the endpoints to be tested.
Click
.If asked, add JUnit to the build path.
The artifacts for the test are added to your project. The class implementing the test case is opened in the Java editor.
![]() | Dependencies |
---|---|
Before you can run the test case, you need to add a dependency on
|