Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-8657

Add Maven Plugin to generate route coverage report

    Details

    • Type: New Feature
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 2.21.0
    • Component/s: tests, tooling
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      With help from CAMEL-8656 we can enable unit tests to generate xml files with route statistics.

      What we need is then a mvn plugin to generate a nice report from those, such as a html page that has a summary, and then a detailed route with colored lines for route usage, so you can spot which routes has unused parts etc.

      For starters the route can be dumped as xml from the report as its already in xml format. Its a matter of removing the noise, and then apply css or what style to do if exchangesTotal=0 and if its > 0 etc.

        Activity

        Hide
        davsclaus Claus Ibsen added a comment -

        We are not so far of now, there is api in camel-core to dump the route coverage as xml, which camel-test can dump to files automatic.

        What is needed is then a maven report plugin that traverses those xml files and generate a nice

        • index.html
        • html file per unit test

        The html file then shows the route as xml, and then have green / red color lines (or what we choose) to highlight the coverage of the routes. There can be tooltips to show processing times per node, or something like that.

        Maybe take a look at cobertura or emma reports how they do it for java code.

        Show
        davsclaus Claus Ibsen added a comment - We are not so far of now, there is api in camel-core to dump the route coverage as xml, which camel-test can dump to files automatic. What is needed is then a maven report plugin that traverses those xml files and generate a nice index.html html file per unit test The html file then shows the route as xml, and then have green / red color lines (or what we choose) to highlight the coverage of the routes. There can be tooltips to show processing times per node, or something like that. Maybe take a look at cobertura or emma reports how they do it for java code.
        Hide
        davsclaus Claus Ibsen added a comment -

        example of cobertura

        Show
        davsclaus Claus Ibsen added a comment - example of cobertura
        Hide
        davsclaus Claus Ibsen added a comment -

        I posted to Camel dev mailing list about ppl wanna help with this and with some points to do. So take a look at the dev forum
        http://camel.465427.n5.nabble.com/Camel-Development-f479097.html

        Show
        davsclaus Claus Ibsen added a comment - I posted to Camel dev mailing list about ppl wanna help with this and with some points to do. So take a look at the dev forum http://camel.465427.n5.nabble.com/Camel-Development-f479097.html
        Hide
        gautric Greg A. added a comment -

        We can create an XSLT to convert XML to HTML.
        I think it is the quickest way to achieve it.
        could you post an XML Camel code coverage sample ?

        Show
        gautric Greg A. added a comment - We can create an XSLT to convert XML to HTML. I think it is the quickest way to achieve it. could you post an XML Camel code coverage sample ?
        Hide
        davsclaus Claus Ibsen added a comment -

        Attached a xml file as output.

        Show
        davsclaus Claus Ibsen added a comment - Attached a xml file as output.
        Hide
        davsclaus Claus Ibsen added a comment -

        We need to enrich the xml file with more details about the test such as

        • class name
        • method name
        • time taken
        • if test was success or failure (if that is possible)
        • date and time of running the test
        • etc.

        Information we can use in the generated html reports.

        Show
        davsclaus Claus Ibsen added a comment - We need to enrich the xml file with more details about the test such as class name method name time taken if test was success or failure (if that is possible) date and time of running the test etc. Information we can use in the generated html reports.
        Hide
        davsclaus Claus Ibsen added a comment -

        Posted a blog and recorded a video of the tooling in action (early prototype)
        http://www.davsclaus.com/2017/10/apache-camel-route-coverage-tooling-on.html

        Show
        davsclaus Claus Ibsen added a comment - Posted a blog and recorded a video of the tooling in action (early prototype) http://www.davsclaus.com/2017/10/apache-camel-route-coverage-tooling-on.html
        Hide
        davsclaus Claus Ibsen added a comment -

        The code has been merged to master branch, and it now support anonymous routes. It may take a little bit more love to make the code more polished and also there can be some edge cases. Also the summary should be improved to have a overall at the end. Also we can output how many test classes / test methods that are in use for the route coverage as well.

        Show
        davsclaus Claus Ibsen added a comment - The code has been merged to master branch, and it now support anonymous routes. It may take a little bit more love to make the code more polished and also there can be some edge cases. Also the summary should be improved to have a overall at the end. Also we can output how many test classes / test methods that are in use for the route coverage as well.
        Hide
        davsclaus Claus Ibsen added a comment -

        You can try by first testing with route coverage enabled

        mvn clean test -DCamelTestRouteCoverage=true

        And then run the report with

        mvn org.apache.camel:camel-maven-plugin:2.21.0-SNAPSHOT:route-coverage -Dcamel.includeTest=true -Dcamel.anonymousRoutes=true

        Show
        davsclaus Claus Ibsen added a comment - You can try by first testing with route coverage enabled mvn clean test -DCamelTestRouteCoverage=true And then run the report with mvn org.apache.camel:camel-maven-plugin:2.21.0-SNAPSHOT:route-coverage -Dcamel.includeTest=true -Dcamel.anonymousRoutes=true

          People

          • Assignee:
            davsclaus Claus Ibsen
            Reporter:
            davsclaus Claus Ibsen
          • Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:

              Development