hello, I was wondering about the use of the DirtiesContext-annotation at the class-level. According to http://camel.apache.org/spring-testing.html, it "forces Spring Testing to automatically reload the CamelContext after each test method - this ensures that the tests don't clash with each other". Reloading the CamelContext takes a while, and I find that my tests are time consuming when using this annotation (option 1 below).
I find that my test run much faster with option 2 below, but I am not sure about the side-effects. All tests send messages to the same endpoint which is mockEndpointsAndSkip in the adviceWith, but I find when I stop and start the context, the tests do seem to run isolated. Any thoughts? Option 1, DirtiesContext: @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @RunWith(CamelSpringJUnit4ClassRunner.class) @UseAdviceWith public final class RouteBuilderTest {... @Before public void setupRouteDefinitionAdviceHttp() throws Exception { context.getRouteDefinition(Route.SOLRIZE.name()).adviceWith(context, new AdviceWithRouteBuilder() { @Override void configure() throws Exception { mockEndpointsAndSkip("http4:localhost:5432"); } }) context.start(); } Option 2, just restart the context: @RunWith(CamelSpringJUnit4ClassRunner.class) @UseAdviceWith public final class RouteBuilderTest {... @Before public void setupRouteDefinitionAdviceHttp() throws Exception { context.getRouteDefinition(Route.SOLRIZE.name()).adviceWith(context, new AdviceWithRouteBuilder() { @Override void configure() throws Exception { mockEndpointsAndSkip("http4:localhost:5432"); } }) context.start(); } @After public void stopContext() { context.stop(); } -- View this message in context: http://camel.465427.n5.nabble.com/DirtiesContext-vs-just-restarting-context-tp5742981.html Sent from the Camel - Users mailing list archive at Nabble.com.