How to generate jacoco code coverage reports from jacoco.exec generated on remote server











up vote
0
down vote

favorite












I'm trying to generate jacoco code coverage reports from the jacoco exec file (generated on remote server) which I have copied into Jenkins workspace.



My requirement is to start the server in a remote location, then executes scenario tests against the remote server and get the code coverage.



For that purpose, I have placed the jacoco agent in the server side, then attach the jacoco agent as a JVM option and do the instrumentation on the server side. This will automatically generate an empty jacoco exec file in the server side when the server starts up. Then I execute the tests and shutdown the server. Next the generated jacoco exec has copied to jenkins workspace and create a freestyle project. Then added only the exec file in the "Record jacoco coverage report" under "Post-build actions". After that when I triggered a build, I got the results as "Overall coverage: class: 0, method: 0, line: 0, branch: 0, instruction: 0". Could you please help me to get this solved and generate the reports.



I'm using Jenkins 2.138.2 version and jacoco plugin 3.0.4 version.










share|improve this question









New contributor




MalshaniS is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
























    up vote
    0
    down vote

    favorite












    I'm trying to generate jacoco code coverage reports from the jacoco exec file (generated on remote server) which I have copied into Jenkins workspace.



    My requirement is to start the server in a remote location, then executes scenario tests against the remote server and get the code coverage.



    For that purpose, I have placed the jacoco agent in the server side, then attach the jacoco agent as a JVM option and do the instrumentation on the server side. This will automatically generate an empty jacoco exec file in the server side when the server starts up. Then I execute the tests and shutdown the server. Next the generated jacoco exec has copied to jenkins workspace and create a freestyle project. Then added only the exec file in the "Record jacoco coverage report" under "Post-build actions". After that when I triggered a build, I got the results as "Overall coverage: class: 0, method: 0, line: 0, branch: 0, instruction: 0". Could you please help me to get this solved and generate the reports.



    I'm using Jenkins 2.138.2 version and jacoco plugin 3.0.4 version.










    share|improve this question









    New contributor




    MalshaniS is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I'm trying to generate jacoco code coverage reports from the jacoco exec file (generated on remote server) which I have copied into Jenkins workspace.



      My requirement is to start the server in a remote location, then executes scenario tests against the remote server and get the code coverage.



      For that purpose, I have placed the jacoco agent in the server side, then attach the jacoco agent as a JVM option and do the instrumentation on the server side. This will automatically generate an empty jacoco exec file in the server side when the server starts up. Then I execute the tests and shutdown the server. Next the generated jacoco exec has copied to jenkins workspace and create a freestyle project. Then added only the exec file in the "Record jacoco coverage report" under "Post-build actions". After that when I triggered a build, I got the results as "Overall coverage: class: 0, method: 0, line: 0, branch: 0, instruction: 0". Could you please help me to get this solved and generate the reports.



      I'm using Jenkins 2.138.2 version and jacoco plugin 3.0.4 version.










      share|improve this question









      New contributor




      MalshaniS is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      I'm trying to generate jacoco code coverage reports from the jacoco exec file (generated on remote server) which I have copied into Jenkins workspace.



      My requirement is to start the server in a remote location, then executes scenario tests against the remote server and get the code coverage.



      For that purpose, I have placed the jacoco agent in the server side, then attach the jacoco agent as a JVM option and do the instrumentation on the server side. This will automatically generate an empty jacoco exec file in the server side when the server starts up. Then I execute the tests and shutdown the server. Next the generated jacoco exec has copied to jenkins workspace and create a freestyle project. Then added only the exec file in the "Record jacoco coverage report" under "Post-build actions". After that when I triggered a build, I got the results as "Overall coverage: class: 0, method: 0, line: 0, branch: 0, instruction: 0". Could you please help me to get this solved and generate the reports.



      I'm using Jenkins 2.138.2 version and jacoco plugin 3.0.4 version.







      jenkins jacoco jacoco-maven-plugin






      share|improve this question









      New contributor




      MalshaniS is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      MalshaniS is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited Nov 8 at 11:09





















      New contributor




      MalshaniS is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked Nov 8 at 9:55









      MalshaniS

      11




      11




      New contributor




      MalshaniS is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      MalshaniS is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      MalshaniS is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          According to my understanding the jacoco.exec file contains only the information which code has been executed. So in order to measure the code coverage, this information has to be compared with the class files.



          So try to add the class files to the workspace.



          If you also want to drill down into the source code in jenkins, add the source code to your workspace.






          share|improve this answer





















          • I've tried it that way by adding class files to workspace. But still I cannot generate reports. But I can generate the report by adding those class file paths to the POM. Is there any way to generate reports in server side itself in server shutdown.
            – MalshaniS
            Nov 9 at 10:04










          • can you please add the log from jenkins? Also maybe a screenshot from jenkins configuration / workspace
            – wirnse
            Nov 9 at 10:19












          • Please find the attachments as below.
            – MalshaniS
            Nov 9 at 10:55










          • As from your Jenkins Console you do not include any class files. try to use the default plugin configuration or configure the patterns in a way to reflect your workspace.
            – wirnse
            Nov 9 at 11:07










          • I have a set of .jar files which I need to pass into class files section. But I cannot provide the jar files with the default plugin configuration. How can I pass them?
            – MalshaniS
            2 days ago











          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
          });


          }
          });






          MalshaniS is a new contributor. Be nice, and check out our Code of Conduct.










           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53205265%2fhow-to-generate-jacoco-code-coverage-reports-from-jacoco-exec-generated-on-remot%23new-answer', 'question_page');
          }
          );

          Post as a guest
































          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote













          According to my understanding the jacoco.exec file contains only the information which code has been executed. So in order to measure the code coverage, this information has to be compared with the class files.



          So try to add the class files to the workspace.



          If you also want to drill down into the source code in jenkins, add the source code to your workspace.






          share|improve this answer





















          • I've tried it that way by adding class files to workspace. But still I cannot generate reports. But I can generate the report by adding those class file paths to the POM. Is there any way to generate reports in server side itself in server shutdown.
            – MalshaniS
            Nov 9 at 10:04










          • can you please add the log from jenkins? Also maybe a screenshot from jenkins configuration / workspace
            – wirnse
            Nov 9 at 10:19












          • Please find the attachments as below.
            – MalshaniS
            Nov 9 at 10:55










          • As from your Jenkins Console you do not include any class files. try to use the default plugin configuration or configure the patterns in a way to reflect your workspace.
            – wirnse
            Nov 9 at 11:07










          • I have a set of .jar files which I need to pass into class files section. But I cannot provide the jar files with the default plugin configuration. How can I pass them?
            – MalshaniS
            2 days ago















          up vote
          0
          down vote













          According to my understanding the jacoco.exec file contains only the information which code has been executed. So in order to measure the code coverage, this information has to be compared with the class files.



          So try to add the class files to the workspace.



          If you also want to drill down into the source code in jenkins, add the source code to your workspace.






          share|improve this answer





















          • I've tried it that way by adding class files to workspace. But still I cannot generate reports. But I can generate the report by adding those class file paths to the POM. Is there any way to generate reports in server side itself in server shutdown.
            – MalshaniS
            Nov 9 at 10:04










          • can you please add the log from jenkins? Also maybe a screenshot from jenkins configuration / workspace
            – wirnse
            Nov 9 at 10:19












          • Please find the attachments as below.
            – MalshaniS
            Nov 9 at 10:55










          • As from your Jenkins Console you do not include any class files. try to use the default plugin configuration or configure the patterns in a way to reflect your workspace.
            – wirnse
            Nov 9 at 11:07










          • I have a set of .jar files which I need to pass into class files section. But I cannot provide the jar files with the default plugin configuration. How can I pass them?
            – MalshaniS
            2 days ago













          up vote
          0
          down vote










          up vote
          0
          down vote









          According to my understanding the jacoco.exec file contains only the information which code has been executed. So in order to measure the code coverage, this information has to be compared with the class files.



          So try to add the class files to the workspace.



          If you also want to drill down into the source code in jenkins, add the source code to your workspace.






          share|improve this answer












          According to my understanding the jacoco.exec file contains only the information which code has been executed. So in order to measure the code coverage, this information has to be compared with the class files.



          So try to add the class files to the workspace.



          If you also want to drill down into the source code in jenkins, add the source code to your workspace.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 9 at 5:02









          wirnse

          30615




          30615












          • I've tried it that way by adding class files to workspace. But still I cannot generate reports. But I can generate the report by adding those class file paths to the POM. Is there any way to generate reports in server side itself in server shutdown.
            – MalshaniS
            Nov 9 at 10:04










          • can you please add the log from jenkins? Also maybe a screenshot from jenkins configuration / workspace
            – wirnse
            Nov 9 at 10:19












          • Please find the attachments as below.
            – MalshaniS
            Nov 9 at 10:55










          • As from your Jenkins Console you do not include any class files. try to use the default plugin configuration or configure the patterns in a way to reflect your workspace.
            – wirnse
            Nov 9 at 11:07










          • I have a set of .jar files which I need to pass into class files section. But I cannot provide the jar files with the default plugin configuration. How can I pass them?
            – MalshaniS
            2 days ago


















          • I've tried it that way by adding class files to workspace. But still I cannot generate reports. But I can generate the report by adding those class file paths to the POM. Is there any way to generate reports in server side itself in server shutdown.
            – MalshaniS
            Nov 9 at 10:04










          • can you please add the log from jenkins? Also maybe a screenshot from jenkins configuration / workspace
            – wirnse
            Nov 9 at 10:19












          • Please find the attachments as below.
            – MalshaniS
            Nov 9 at 10:55










          • As from your Jenkins Console you do not include any class files. try to use the default plugin configuration or configure the patterns in a way to reflect your workspace.
            – wirnse
            Nov 9 at 11:07










          • I have a set of .jar files which I need to pass into class files section. But I cannot provide the jar files with the default plugin configuration. How can I pass them?
            – MalshaniS
            2 days ago
















          I've tried it that way by adding class files to workspace. But still I cannot generate reports. But I can generate the report by adding those class file paths to the POM. Is there any way to generate reports in server side itself in server shutdown.
          – MalshaniS
          Nov 9 at 10:04




          I've tried it that way by adding class files to workspace. But still I cannot generate reports. But I can generate the report by adding those class file paths to the POM. Is there any way to generate reports in server side itself in server shutdown.
          – MalshaniS
          Nov 9 at 10:04












          can you please add the log from jenkins? Also maybe a screenshot from jenkins configuration / workspace
          – wirnse
          Nov 9 at 10:19






          can you please add the log from jenkins? Also maybe a screenshot from jenkins configuration / workspace
          – wirnse
          Nov 9 at 10:19














          Please find the attachments as below.
          – MalshaniS
          Nov 9 at 10:55




          Please find the attachments as below.
          – MalshaniS
          Nov 9 at 10:55












          As from your Jenkins Console you do not include any class files. try to use the default plugin configuration or configure the patterns in a way to reflect your workspace.
          – wirnse
          Nov 9 at 11:07




          As from your Jenkins Console you do not include any class files. try to use the default plugin configuration or configure the patterns in a way to reflect your workspace.
          – wirnse
          Nov 9 at 11:07












          I have a set of .jar files which I need to pass into class files section. But I cannot provide the jar files with the default plugin configuration. How can I pass them?
          – MalshaniS
          2 days ago




          I have a set of .jar files which I need to pass into class files section. But I cannot provide the jar files with the default plugin configuration. How can I pass them?
          – MalshaniS
          2 days ago










          MalshaniS is a new contributor. Be nice, and check out our Code of Conduct.










           

          draft saved


          draft discarded


















          MalshaniS is a new contributor. Be nice, and check out our Code of Conduct.













          MalshaniS is a new contributor. Be nice, and check out our Code of Conduct.












          MalshaniS is a new contributor. Be nice, and check out our Code of Conduct.















           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53205265%2fhow-to-generate-jacoco-code-coverage-reports-from-jacoco-exec-generated-on-remot%23new-answer', 'question_page');
          }
          );

          Post as a guest




















































































          Popular posts from this blog

          Schultheiß

          Verwaltungsgliederung Dänemarks

          Liste der Kulturdenkmale in Wilsdruff