It turns out that the "camel.springboot.xml-routes" property works for tests as well but it gets applied only when I don't use @ContextConfiguration This results in having the default camel context during the tests, so some additional things like adding some components should be done by hand Is this the only way I can go? And does anybody else use xml routes? 😊
-----Original Message----- From: Ivanov, Grigorii <grigorii.iva...@t-systems.com> Sent: Wednesday, February 17, 2021 1:30 PM To: users@camel.apache.org Subject: routes testing Hello all, I have a camel spring boot application with routes in separate XML files I want to write some unit tests but there is a problem to find these routes from a test class, it is able to start routes only if I put them into the camelContext element I know I can specify which directories should be scan for xml routes using "camel.springboot.xml-routes" property (at the moment I am at Camel 2.23) for an application itself, and what about a test class? Is there a way to let it know where the routes are? Thanks in advance! My test class is as simple as @RunWith(CamelSpringBootRunner.class) @SpringBootTest @ContextConfiguration(locations = "classpath:beans.xml") @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) public class DemoApplicationTests { @Autowired private CamelContext camelContext; @Autowired private ProducerTemplate template; @EndpointInject(uri="mock:test") private MockEndpoint mocked; @Test public void simpleTest() throws Exception { mocked.expectedMessageCount(1); template.sendBody( "direct:start", "Hello"); mocked.assertIsSatisfied(); }; } Best regards, Grigorii