This discussion is archived
5 Replies Latest reply: Sep 6, 2013 4:42 AM by Nitin Khare RSS

Code Coverage Tools

boyd4715 Newbie
Currently Being Moderated

I am looking to see if anyone has had any experience using code coverage tools with ATG?  I am trying to determine what code is being used, to help identify class and methods and of course identifiy dead code as well.

  • 1. Re: Code Coverage Tools
    GopinathRamasamy Journeyer
    Currently Being Moderated

    Hi,

     

    Please check for CodePro which we used in one of our ATG projects in a customized form. It is easy to use and I believe will suit your requirements.

     

    More details -> https://developers.google.com/java-dev-tools/codepro/doc/features/codecoverage/code_coverage

     

    There are other commercial products as well. You may like to check SonarQube™ » Features for more details.

     

    Hope this helps.

    Keep posting the updates.

     

    Thanks,

    Gopinath Ramasamy

  • 2. Re: Code Coverage Tools
    boyd4715 Newbie
    Currently Being Moderated

    Gopinath,

     

    Can you provide more information on this - I tried to use the tool but I am not really seeing anyting - So I would have to assume that I do not have things configured correctly.

     

    Here is what I did - I selected the project of interested, right clicked, selected CodePro and then selected Instrument the code for coverage.  Then I rebuild the code base and then deployed to JBoss and ran the code.

     

    Will it generate some type of report that I can then import into Eclipse to read it?

     

    Or do I need to follow some other steps?

  • 3. Re: Code Coverage Tools
    GopinathRamasamy Journeyer
    Currently Being Moderated

    Hi,

     

    You can use it in multiple ways. If you have installed the eclipse plugins, you can see the options in the menu bar itself under CodePro.

     

    You can also go to the individual file (ex: YourDroplet.java) -> RightClick -> CodePro Tools -> Audit..

     

    This will present a report with severity, description etc with the line number in the code. You can also export or email report.

     

    Please check this.

     

    Hope this helps.

    Keep posting the questions / updates.

     

    Thanks,

    Gopinath Ramasamy

  • 4. Re: Code Coverage Tools
    boyd4715 Newbie
    Currently Being Moderated

    I must be thick in the head for I am still not clear as to your meaning.  So below is what I am doing please review and let me know what I am missing here:

     

    1.  In eclipse, I selected my project

    2.  Right click on the project and selected CodePro Tools

    3.  Then selected Instrument for Code coverage

    4.  Then Save the project exit out of eclipse.

    5.  Run ant to build the ear and then deploy it to JBOSS

    6.  Run the application and do some testing.

     

    Now - Are the results stored some where?  Which I can then import into eclipse?  I have not located anything as of yet.

  • 5. Re: Code Coverage Tools
    Nitin Khare Expert
    Currently Being Moderated

     

    1.  In eclipse, I selected my project

    2.  Right click on the project and selected CodePro Tools

    3.  Then selected Instrument for Code coverage

    4.  Then Save the project exit out of eclipse.

    5.  Run ant to build the ear and then deploy it to JBOSS

    6.  Run the application and do some testing.

     

    Now - Are the results stored some where?  Which I can then import into eclipse?  I have not located anything as of yet.

    I have not tried it but I think you need not exit from Eclipse here as class' bytecodes loaded by the VM has to be instrumented dynamically so that data about which bytecodes have been executed can be collected which won't happen if you exit from Eclipse. You can probably try building your EAR and starting the JBoss server from within Eclipse through your own launch configuration. You can also refer this:

     

    https://developers.google.com/java-dev-tools/codepro/doc/features/codecoverage/code_coverage_launch_configuration

     

    See if it helps.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points