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

TestNG Results Trend graph doesn't show all build results

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • testng-plugin
    • None

      When some of builds were deleted from BuildHistory, TestNG Results Trend graph does not show all preceding builds anymore.

      Steps to reproduce:
      1. Make several builds (#1, #2, #3) with test results.
      2. Make one more build (#4). Delete it manually from build History
      3. Make few more builds (#5, #6) and see to graph.
      *Expected result: *graph contains build #1, #2, #3, #5, #6 (all but deleted)

      • Actual result: *graph contains only results after deleted one: #5, #6

      Note: I use job to run tests only and deleting builds by hand sometimes required to cleanup history from false-failed builds (after incorrect changes in job settings, problems with network/environment during tests etc.)

          [JENKINS-32746] TestNG Results Trend graph doesn't show all build results

          Oleksandr Kulychok added a comment - - edited

          It seems problem in hudson.plugins.testng.TestNGProjectAction#populateDataSetBuilder() in loop termination condition:

           protected void populateDataSetBuilder(DataSetBuilder<String, ChartUtil.NumberOnlyBuildLabel> dataset) {
                Set<Integer> loadedBuilds = getProject()._getRuns().getLoadedBuilds().keySet(); // cf. AbstractTestResultAction.getPreviousResult(Class, false)
                for (AbstractBuild<?, ?> build = getProject().getLastBuild();
                      build != null; 
                      build = loadedBuilds.contains(build.number - 1) ? build.getPreviousCompletedBuild() : null) {
          
                      <for-loop here>
                }
          }
          

          Question: can we remove condition and replace
          build = loadedBuilds.contains(build.number - 1) ? build.getPreviousCompletedBuild() : null)
          to
          build = build.getPreviousCompletedBuild()
          ?

          Also I suggest to introduce one more parameter for graph: max results on graph (to not overload graph in case we have huge results in build history)

          Oleksandr Kulychok added a comment - - edited It seems problem in hudson.plugins.testng.TestNGProjectAction#populateDataSetBuilder() in loop termination condition: protected void populateDataSetBuilder(DataSetBuilder< String , ChartUtil.NumberOnlyBuildLabel> dataset) { Set< Integer > loadedBuilds = getProject()._getRuns().getLoadedBuilds().keySet(); // cf. AbstractTestResultAction.getPreviousResult( Class , false ) for (AbstractBuild<?, ?> build = getProject().getLastBuild(); build != null ; build = loadedBuilds.contains(build.number - 1) ? build.getPreviousCompletedBuild() : null ) { < for -loop here> } } Question: can we remove condition and replace build = loadedBuilds.contains(build.number - 1) ? build.getPreviousCompletedBuild() : null) to build = build.getPreviousCompletedBuild() ? Also I suggest to introduce one more parameter for graph: max results on graph (to not overload graph in case we have huge results in build history)

          Swapnil Verma added a comment -

          Upvoting this jira.

          Please, can we have this jira fixed as per Oleksandr Kulychok suggestion.

          Thanks in advance.

          Swapnil Verma added a comment - Upvoting this jira. Please, can we have this jira fixed as per Oleksandr Kulychok suggestion. Thanks in advance.

          Upvoting this Jira. Facing the same issue. 

          Appreciate a fix.

          Thiro Gunaratne added a comment - Upvoting this Jira. Facing the same issue.  Appreciate a fix.

          Code changed in jenkins
          User: Julien Herr
          Path:
          src/main/java/hudson/plugins/testng/TestNGProjectAction.java
          src/test/java/hudson/plugins/testng/TestNGProjectActionTest.java
          http://jenkins-ci.org/commit/testng-plugin-plugin/a956ec056cd20aed8367d42b3541b7e3055b07df
          Log:
          [FIXED JENKINS-32746] Change loop determination condition in order to check all loaded builds

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Julien Herr Path: src/main/java/hudson/plugins/testng/TestNGProjectAction.java src/test/java/hudson/plugins/testng/TestNGProjectActionTest.java http://jenkins-ci.org/commit/testng-plugin-plugin/a956ec056cd20aed8367d42b3541b7e3055b07df Log: [FIXED JENKINS-32746] Change loop determination condition in order to check all loaded builds

          Code changed in jenkins
          User: Nalin Makar
          Path:
          src/main/java/hudson/plugins/testng/TestNGProjectAction.java
          src/test/java/hudson/plugins/testng/TestNGProjectActionTest.java
          http://jenkins-ci.org/commit/testng-plugin-plugin/c9c17feaec6d349a48ebded852635bd0f6e8d4c0
          Log:
          Merge pull request #29 from juherr/JENKINS-32746

          Fix JENKINS-32746: Change loop determination condition in order to check all loaded builds

          Compare: https://github.com/jenkinsci/testng-plugin-plugin/compare/25ff107f8cab...c9c17feaec6d

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Nalin Makar Path: src/main/java/hudson/plugins/testng/TestNGProjectAction.java src/test/java/hudson/plugins/testng/TestNGProjectActionTest.java http://jenkins-ci.org/commit/testng-plugin-plugin/c9c17feaec6d349a48ebded852635bd0f6e8d4c0 Log: Merge pull request #29 from juherr/ JENKINS-32746 Fix JENKINS-32746 : Change loop determination condition in order to check all loaded builds Compare: https://github.com/jenkinsci/testng-plugin-plugin/compare/25ff107f8cab...c9c17feaec6d

            Unassigned Unassigned
            kool79 Oleksandr Kulychok
            Votes:
            4 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: