How to generate a report with a list of test cases covering each method in the code?









up vote
1
down vote

favorite












I need to generate a report with all the methods (both public and private) in the code and a list of test cases covering each method.
I am using Java 8 for actual code and groovy for unit tests.



I am using Sonarqube which gives whether the line is covered. It doesn't show what test cases are covering this line. Anyway, I wanted the list of tests per method and not per line.



Thanks in advance.



Edit 1:
I am using Jacoco which gives lines covered by individual unit test case and lines covered in a method in actual code by test cases.
Please let me know whether there is a way I can get a report which gives all the test cases that cover a given method.










share|improve this question



























    up vote
    1
    down vote

    favorite












    I need to generate a report with all the methods (both public and private) in the code and a list of test cases covering each method.
    I am using Java 8 for actual code and groovy for unit tests.



    I am using Sonarqube which gives whether the line is covered. It doesn't show what test cases are covering this line. Anyway, I wanted the list of tests per method and not per line.



    Thanks in advance.



    Edit 1:
    I am using Jacoco which gives lines covered by individual unit test case and lines covered in a method in actual code by test cases.
    Please let me know whether there is a way I can get a report which gives all the test cases that cover a given method.










    share|improve this question

























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I need to generate a report with all the methods (both public and private) in the code and a list of test cases covering each method.
      I am using Java 8 for actual code and groovy for unit tests.



      I am using Sonarqube which gives whether the line is covered. It doesn't show what test cases are covering this line. Anyway, I wanted the list of tests per method and not per line.



      Thanks in advance.



      Edit 1:
      I am using Jacoco which gives lines covered by individual unit test case and lines covered in a method in actual code by test cases.
      Please let me know whether there is a way I can get a report which gives all the test cases that cover a given method.










      share|improve this question















      I need to generate a report with all the methods (both public and private) in the code and a list of test cases covering each method.
      I am using Java 8 for actual code and groovy for unit tests.



      I am using Sonarqube which gives whether the line is covered. It doesn't show what test cases are covering this line. Anyway, I wanted the list of tests per method and not per line.



      Thanks in advance.



      Edit 1:
      I am using Jacoco which gives lines covered by individual unit test case and lines covered in a method in actual code by test cases.
      Please let me know whether there is a way I can get a report which gives all the test cases that cover a given method.







      java unit-testing groovy sonarqube jacoco






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 12 at 6:50

























      asked Nov 11 at 19:40









      Srikanth P Vasist

      5392621




      5392621






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          Take a look at Jacoco- a code coverage tool which is free, and can generate a code coverage report



          It has plugins for maven and gradle so that you can integrate it into your build process.
          Later on sonar plugin should pick this report and show in sonar






          share|improve this answer




















          • Thanks, @Mark Bramnik. I am using Jacoco and getting other useful metrics. Do you know how we can generate a report with a list of test cases covering each method in the code in Jacoco?
            – Srikanth P Vasist
            Nov 12 at 6:52










          • Its what jacoco really has to do, its a core functionality. Usually the build tool that runs the tests instruments the code with jacoco and it produces its reports. You haven't specified a build tool, but if you use maven, for example, than there is a maven plugin eclemma.org/jacoco/trunk/doc/report-mojo.html that can be defined in pom.xml. For gradle a similar solution should exist
            – Mark Bramnik
            Nov 12 at 7:09










          • I use Maven. I found many reports regarding the percentage of coverage of the code and individual files as in above mentioned link but, not per methods. Also, I couldn't find or generate any report which could give a list of test cases per method. Could you please point me to a web link if you have one? Thanks!
            – Srikanth P Vasist
            Nov 12 at 16:27










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53252489%2fhow-to-generate-a-report-with-a-list-of-test-cases-covering-each-method-in-the-c%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote













          Take a look at Jacoco- a code coverage tool which is free, and can generate a code coverage report



          It has plugins for maven and gradle so that you can integrate it into your build process.
          Later on sonar plugin should pick this report and show in sonar






          share|improve this answer




















          • Thanks, @Mark Bramnik. I am using Jacoco and getting other useful metrics. Do you know how we can generate a report with a list of test cases covering each method in the code in Jacoco?
            – Srikanth P Vasist
            Nov 12 at 6:52










          • Its what jacoco really has to do, its a core functionality. Usually the build tool that runs the tests instruments the code with jacoco and it produces its reports. You haven't specified a build tool, but if you use maven, for example, than there is a maven plugin eclemma.org/jacoco/trunk/doc/report-mojo.html that can be defined in pom.xml. For gradle a similar solution should exist
            – Mark Bramnik
            Nov 12 at 7:09










          • I use Maven. I found many reports regarding the percentage of coverage of the code and individual files as in above mentioned link but, not per methods. Also, I couldn't find or generate any report which could give a list of test cases per method. Could you please point me to a web link if you have one? Thanks!
            – Srikanth P Vasist
            Nov 12 at 16:27














          up vote
          0
          down vote













          Take a look at Jacoco- a code coverage tool which is free, and can generate a code coverage report



          It has plugins for maven and gradle so that you can integrate it into your build process.
          Later on sonar plugin should pick this report and show in sonar






          share|improve this answer




















          • Thanks, @Mark Bramnik. I am using Jacoco and getting other useful metrics. Do you know how we can generate a report with a list of test cases covering each method in the code in Jacoco?
            – Srikanth P Vasist
            Nov 12 at 6:52










          • Its what jacoco really has to do, its a core functionality. Usually the build tool that runs the tests instruments the code with jacoco and it produces its reports. You haven't specified a build tool, but if you use maven, for example, than there is a maven plugin eclemma.org/jacoco/trunk/doc/report-mojo.html that can be defined in pom.xml. For gradle a similar solution should exist
            – Mark Bramnik
            Nov 12 at 7:09










          • I use Maven. I found many reports regarding the percentage of coverage of the code and individual files as in above mentioned link but, not per methods. Also, I couldn't find or generate any report which could give a list of test cases per method. Could you please point me to a web link if you have one? Thanks!
            – Srikanth P Vasist
            Nov 12 at 16:27












          up vote
          0
          down vote










          up vote
          0
          down vote









          Take a look at Jacoco- a code coverage tool which is free, and can generate a code coverage report



          It has plugins for maven and gradle so that you can integrate it into your build process.
          Later on sonar plugin should pick this report and show in sonar






          share|improve this answer












          Take a look at Jacoco- a code coverage tool which is free, and can generate a code coverage report



          It has plugins for maven and gradle so that you can integrate it into your build process.
          Later on sonar plugin should pick this report and show in sonar







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 11 at 20:38









          Mark Bramnik

          11.3k32445




          11.3k32445











          • Thanks, @Mark Bramnik. I am using Jacoco and getting other useful metrics. Do you know how we can generate a report with a list of test cases covering each method in the code in Jacoco?
            – Srikanth P Vasist
            Nov 12 at 6:52










          • Its what jacoco really has to do, its a core functionality. Usually the build tool that runs the tests instruments the code with jacoco and it produces its reports. You haven't specified a build tool, but if you use maven, for example, than there is a maven plugin eclemma.org/jacoco/trunk/doc/report-mojo.html that can be defined in pom.xml. For gradle a similar solution should exist
            – Mark Bramnik
            Nov 12 at 7:09










          • I use Maven. I found many reports regarding the percentage of coverage of the code and individual files as in above mentioned link but, not per methods. Also, I couldn't find or generate any report which could give a list of test cases per method. Could you please point me to a web link if you have one? Thanks!
            – Srikanth P Vasist
            Nov 12 at 16:27
















          • Thanks, @Mark Bramnik. I am using Jacoco and getting other useful metrics. Do you know how we can generate a report with a list of test cases covering each method in the code in Jacoco?
            – Srikanth P Vasist
            Nov 12 at 6:52










          • Its what jacoco really has to do, its a core functionality. Usually the build tool that runs the tests instruments the code with jacoco and it produces its reports. You haven't specified a build tool, but if you use maven, for example, than there is a maven plugin eclemma.org/jacoco/trunk/doc/report-mojo.html that can be defined in pom.xml. For gradle a similar solution should exist
            – Mark Bramnik
            Nov 12 at 7:09










          • I use Maven. I found many reports regarding the percentage of coverage of the code and individual files as in above mentioned link but, not per methods. Also, I couldn't find or generate any report which could give a list of test cases per method. Could you please point me to a web link if you have one? Thanks!
            – Srikanth P Vasist
            Nov 12 at 16:27















          Thanks, @Mark Bramnik. I am using Jacoco and getting other useful metrics. Do you know how we can generate a report with a list of test cases covering each method in the code in Jacoco?
          – Srikanth P Vasist
          Nov 12 at 6:52




          Thanks, @Mark Bramnik. I am using Jacoco and getting other useful metrics. Do you know how we can generate a report with a list of test cases covering each method in the code in Jacoco?
          – Srikanth P Vasist
          Nov 12 at 6:52












          Its what jacoco really has to do, its a core functionality. Usually the build tool that runs the tests instruments the code with jacoco and it produces its reports. You haven't specified a build tool, but if you use maven, for example, than there is a maven plugin eclemma.org/jacoco/trunk/doc/report-mojo.html that can be defined in pom.xml. For gradle a similar solution should exist
          – Mark Bramnik
          Nov 12 at 7:09




          Its what jacoco really has to do, its a core functionality. Usually the build tool that runs the tests instruments the code with jacoco and it produces its reports. You haven't specified a build tool, but if you use maven, for example, than there is a maven plugin eclemma.org/jacoco/trunk/doc/report-mojo.html that can be defined in pom.xml. For gradle a similar solution should exist
          – Mark Bramnik
          Nov 12 at 7:09












          I use Maven. I found many reports regarding the percentage of coverage of the code and individual files as in above mentioned link but, not per methods. Also, I couldn't find or generate any report which could give a list of test cases per method. Could you please point me to a web link if you have one? Thanks!
          – Srikanth P Vasist
          Nov 12 at 16:27




          I use Maven. I found many reports regarding the percentage of coverage of the code and individual files as in above mentioned link but, not per methods. Also, I couldn't find or generate any report which could give a list of test cases per method. Could you please point me to a web link if you have one? Thanks!
          – Srikanth P Vasist
          Nov 12 at 16:27

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53252489%2fhow-to-generate-a-report-with-a-list-of-test-cases-covering-each-method-in-the-c%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          Barbados

          How to read a connectionString WITH PROVIDER in .NET Core?

          Node.js Script on GitHub Pages or Amazon S3