Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed: JENKINS-16832 - Do not show failed builds in trend graph
  • Loading branch information
nullin committed Jun 30, 2013
1 parent eaaa411 commit f5c5f07
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
3 changes: 2 additions & 1 deletion README
Expand Up @@ -17,7 +17,8 @@ Release Notes
-------

### v1.2
* Fixed: JENKINS-18498 - hudson.tasks.test.AggregatedTestResultAction$1 cannot be cast to hudson.tasks.test.TestResult
* Fixed: JENKINS-18498 - hudson.tasks.test.AggregatedTestResultAction$1 cannot be cast to hudson.tasks.test.TestResult
* Fixed: JENKINS-16832 - Do not show failed builds in trend graph

### v1.1
* Fixed: JENKINS-16592 - Invalid URL in testngreport on tests execution history chart
Expand Down
24 changes: 12 additions & 12 deletions src/main/java/hudson/plugins/testng/TestNGProjectAction.java
@@ -1,20 +1,21 @@
package hudson.plugins.testng;

import java.io.IOException;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;

import hudson.model.AbstractBuild;
import hudson.model.AbstractProject;
import hudson.model.ProminentProjectAction;
import hudson.model.Result;
import hudson.plugins.testng.util.GraphHelper;
import hudson.util.ChartUtil;
import hudson.util.DataSetBuilder;
import org.jfree.chart.JFreeChart;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;

import java.io.IOException;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;

/**
* Action to associate the TestNG reports with the project
*
Expand Down Expand Up @@ -159,7 +160,7 @@ private boolean newGraphNotNeeded(final StaplerRequest req,
return prevNumBuilds == numBuilds && req.checkIfModified(t, rsp);
}

public void doGraphMap(final StaplerRequest req,
public void doGraphMap(final StaplerRequest req,
StaplerResponse rsp) throws IOException {
if (newGraphNotNeeded(req, rsp)) {
return;
Expand Down Expand Up @@ -219,16 +220,15 @@ protected void populateDataSetBuilder(DataSetBuilder<String, ChartUtil.NumberOnl
build = build.getPreviousBuild()) {
ChartUtil.NumberOnlyBuildLabel label = new ChartUtil.NumberOnlyBuildLabel(build);
TestNGTestResultBuildAction action = build.getAction(getBuildActionClass());

if (build.getResult().isWorseThan(Result.UNSTABLE)) {
//We don't want to add aborted, failed or builds with no results into the graph
continue;
}
if (action != null) {
dataset.add(action.getTotalCount() - action.getFailCount() - action.getSkipCount(), "Passed", label);
dataset.add(action.getFailCount(), "Failed", label);
dataset.add(action.getSkipCount(), "Skipped", label);
} else {
//even if testng plugin wasn't run with this build,
//we should add this build to the graph
dataset.add(0, "Passed", label);
dataset.add(0, "Failed", label);
dataset.add(0, "Skipped", label);
}
}
}
Expand Down

0 comments on commit f5c5f07

Please sign in to comment.