Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-50528

Incorrect count of test results in the email body when Job runs in parallel instances

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Major Major
    • email-ext-plugin
    • None
    • Jenkisn 2.89.4, email ext -2.62

      I have created one job and in the email body ,it  uses

      ${TEST_COUNTS,var="pass"}

      ${TEST_COUNTS,var="fail"}  

      ${TEST_COUNTS,var="total"}  

       

      Problem: When the job is executed in parallel on multiple salves, we get email for the results of completion on each slave. However the test count of Passed, Failed cases is incorrect. It seems multiple threads of same job causing the Email ext plugin to  run into identity crisis and it reports incorrect count of test cases.

       

      Note: It works Perfectly when only one instance of Job is run.

          [JENKINS-50528] Incorrect count of test results in the email body when Job runs in parallel instances

          Need more info, but I suspect this is actually the unit test plugins as all those macros do is ask the unit test plugin for the info. If you are using pipeline parallel then unit test info will be the total for all branches at the time the email is sent.

          David van Laatum added a comment - Need more info, but I suspect this is actually the unit test plugins as all those macros do is ask the unit test plugin for the info. If you are using pipeline parallel then unit test info will be the total for all branches at the time the email is sent.

          We are not using pipeline.Actually Same job is run mutiple times using diff choice parameters .So diff instances of same job are run at one time.Each instance sends out an individual email.The problem which happens intermittently is that the Count of test cases passed/failed is incorrect in the email body.

          jaivardhan Singh added a comment - We are not using pipeline.Actually Same job is run mutiple times using diff choice parameters .So diff instances of same job are run at one time.Each instance sends out an individual email.The problem which happens intermittently is that the Count of test cases passed/failed is incorrect in the email body.

          Alex Earl added a comment -

          This is not a bug in the email-ext plugin, you need to file an issue against the unit test plugin you are using to return the correct counts for its implementation of AbstractTestResultAction. Email-ext uses it as below:

          {{
          AbstractTestResultAction<?> action = run.getAction(AbstractTestResultAction.class);
          if (action == null)

          { return ""; }

          var = var.toLowerCase();

          if ("total".equals(var))

          { return String.valueOf(action.getTotalCount()); }

          else if ("pass".equals(var))

          { return String.valueOf(action.getTotalCount()-action.getFailCount()-action.getSkipCount()); }

          else if ("fail".equals(var))

          { return String.valueOf(action.getFailCount()); }

          else if ("skip".equals(var))

          { return String.valueOf(action.getSkipCount()); }

          }}

          Alex Earl added a comment - This is not a bug in the email-ext plugin, you need to file an issue against the unit test plugin you are using to return the correct counts for its implementation of AbstractTestResultAction. Email-ext uses it as below: {{ AbstractTestResultAction<?> action = run.getAction(AbstractTestResultAction.class); if (action == null) { return ""; } var = var.toLowerCase(); if ("total".equals(var)) { return String.valueOf(action.getTotalCount()); } else if ("pass".equals(var)) { return String.valueOf(action.getTotalCount()-action.getFailCount()-action.getSkipCount()); } else if ("fail".equals(var)) { return String.valueOf(action.getFailCount()); } else if ("skip".equals(var)) { return String.valueOf(action.getSkipCount()); } }}

            slide_o_mix Alex Earl
            j1984 jaivardhan Singh
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: