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

TestTrendChart Dashboard does not display number of tests correctly

XMLWordPrintable

      The current implementation calculates the trend graph in this way:

      Time ----|--------|--------|--------|---------|---->
          FirstDate  Build1   Build2   Build3     Today
                     2 tests  3 tests  4 tests
      
      Current graph would be like this:
      9                 |---------------------------| 
      5        |--------|
      2--------|
      
      Instead it should be like this:
      9                          |------------------| 
      5                 |--------|
      2        |--------|
      

      Looking at the source code this is much clear.

      Run run = job.getFirstBuild();
      
            if (run != null) { // execute only if job has builds
              LocalDate lastRunDay = new LocalDate(run.getTimestamp());
              if (dateRange > 0 && firstDay.isAfter(lastRunDay)) {
                lastRunDay = new LocalDate().minusDays(dateRange);
              }
      
              while (run != null) {
                Run nextRun = run.getNextBuild();
                LocalDate runDay = new LocalDate(run.getTimestamp());
      
                  if (nextRun != null) {
                    if (runDay.isAfter(firstDay)) { // skip run before firstDay
                      // if next run is the next day, use this test to summarize
                      if (new LocalDate(nextRun.getTimestamp()).isAfter(runDay)) {
      // mambu: we compute the tests of runDay from lastRunDay to runDay
      // so in the past instead of computing from runDay to nextRunDay!
                        summarize(summaries, run, lastRunDay, runDay);
                        lastRunDay = runDay.plusDays(1);
                      }
                    }
                  } else {
                    // use this run's test result from last run to today
                    summarize(summaries, run, lastRunDay, today);
                  }
      
                run = nextRun;
              }
            }
      

            mambu Marco Ambu
            mambu Marco Ambu
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: