Hi I added route-coverage to this example https://github.com/apache/camel-spring-boot-examples/tree/main/spring-boot
You dont need all those annotations, you should only use @CamelSpringBootTest when testing with spring boot and camel. See that example. On Thu, May 6, 2021 at 4:59 PM Ian Briscoe <ijbris...@googlemail.com.invalid> wrote: > > Hi Claus, > > I added the camel-management dependency, but I still don't see any coverage > data being generated in the target directory, so the route-coverage goal is > still producing errors about the lack of coverage data. > > I'm assuming I'm right in saying that the route validation the Maven report > plugin can do is entirely independent of the code coverage. I mention > that, as it's the only Maven build configuration that is covered in any > detail in the docs. > > I can't get the route coverage report to even attempt to run without at > least this much configuration: > > <plugin> <groupId>org.apache.camel</groupId> <artifactId> > camel-report-maven-plugin</artifactId> </plugin> > > Here I have removed the validation goal. > > Is it possible I need more configuration in the POM file? To that end, > is there any similar code in a "Camel in a Spring Boot application" e.g. in > GitHub, you can point me at that shows a project where code coverage works? > > The other thing I guess it could be, is the test runner. These are the > annotations on my main test: > > @CamelSpringTest > @CamelSpringBootTest > @ContextConfiguration > @RunWith(CamelSpringBootRunner.class) > @BootstrapWith(SpringBootTestContextBootstrapper.class) > @TestInstance(TestInstance.Lifecycle.PER_CLASS) > @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS) > @DisplayName("XXXXX") > @EnableRouteCoverage > > > I inherited these, apart from EnableRouteCoverage, so don't currently fully > understand them all... is it possible there's a problem here? > > > Cheers, > > > Ian > > > On Fri, 30 Apr 2021 at 10:56, Ian Briscoe <ijbris...@googlemail.com> wrote: > > > Thanks, Claus. I'll try that just as soon as I get back to work after the > > holiday weekend - pretty sure that dependency is not currently in the pom. > > > > > > Ian Briscoe > > > > On Fri, 30 Apr 2021 at 08:28, Claus Ibsen <claus.ib...@gmail.com> wrote: > > > >> Hi > >> > >> Can you try adding camel-management as dependency to your classpath. > >> If I recall then JMX is required for collecting coverage data. > >> > >> On Thu, Apr 29, 2021 at 9:37 PM Ian Briscoe > >> <ijbris...@googlemail.com.invalid> wrote: > >> > > >> > Hi, > >> > > >> > We're currently using Camel 3.7, Spring Boot 2.3.9 and code our routes > >> > using the Java DSL. Our tests use JUnit 5. > >> > > >> > I'm interested in using the Camel route coverage report. I've followed > >> all > >> > the directions I can find here: > >> > https://camel.apache.org/manual/latest/camel-report-maven-plugin.html. > >> > > >> > However, when I run my tests, I don't see a directory containing code > >> > coverage information in the target directory, even though I have > >> configured > >> > code coverage for all unit tests using the configuration option given in > >> > the docs. I also tried the @EnableCodeCoverage annotation on the test > >> > classes and the system property method of configuring global coverage on > >> > the Maven command line. > >> > > >> > Without that information, the code coverage report simply says, as > >> > expected: No route coverage data found for route: XXXX. Make sure to > >> enable > >> > route coverage in your unit tests and assign unique route ids to your > >> > routes. Also remember to run unit tests first. > >> > > >> > I do have unique route ids for my routes. > >> > > >> > Does anyone know how to get this working? Is it even compatible with > >> > JUnit 5? I'm suspecting it isn't - it would be useful to have it > >> > confirmed, one way or another. > >> > > >> > > >> > Many thanks, > >> > > >> > > >> > Ian Briscoe > >> > >> > >> > >> -- > >> Claus Ibsen > >> ----------------- > >> http://davsclaus.com @davsclaus > >> Camel in Action 2: https://www.manning.com/ibsen2 > >> > > -- Claus Ibsen ----------------- http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2