hudson.plugins.PerfPublisher.ChangedStatusTestsDetails Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of perfpublisher Show documentation
Show all versions of perfpublisher Show documentation
The PerfPublisher plug-in scans for xml tests reports defined in the administration panel and generates trend graphs, computes stats and underline regressions and modifications. The xml files must be generated by your own testing tool.
package hudson.plugins.PerfPublisher;
import java.awt.Color;
import java.io.IOException;
import java.util.List;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.CategoryAxis;
import org.jfree.chart.axis.CategoryLabelPositions;
import org.jfree.chart.axis.NumberAxis;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.renderer.category.CategoryItemRenderer;
import org.jfree.ui.RectangleInsets;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import hudson.model.ModelObject;
import hudson.model.AbstractBuild;
import hudson.model.Result;
import hudson.plugins.PerfPublisher.Report.Report;
import hudson.plugins.PerfPublisher.Report.ReportContainer;
import hudson.plugins.PerfPublisher.Report.Test;
import hudson.util.ChartUtil;
import hudson.util.ColorPalette;
import hudson.util.DataSetBuilder;
import hudson.util.ShiftedCategoryAxis;
import hudson.util.ChartUtil.NumberOnlyBuildLabel;
public class ChangedStatusTestsDetails implements ModelObject {
private final TrendReport report;
private final AbstractBuild, ?> _owner;
public ChangedStatusTestsDetails(final AbstractBuild, ?> owner, TrendReport rep) {
report = rep;
this._owner = owner;
}
public AbstractBuild, ?> getOwner() {
return _owner;
}
public String getDisplayName() {
return "Details of status changed tests.";
}
public TrendReport getReport() {
return report;
}
public String getPageContent() {
StringBuilder stb = new StringBuilder();
List tests = report.getExecutionStatusChangedTests();
if (tests.size()>0) {
stb.append("");
stb.append("");
stb.append("Tests ");
stb.append("Execution status modification ");
stb.append(" ");
for (int i=0; i"+t.getName()+" ");
if (t.isExecuted()){
stb.append("Not executed Executed ");
}else {
stb.append("Executed Not executed ");
}
stb.append("");
}
stb.append("
");
} else {
stb.append("None of the tests has changed of execution status.
");
}
tests = report.getSuccessStatusChangedTests();
if (tests.size()>0) {
stb.append("");
stb.append("");
stb.append("Tests ");
stb.append("Success status modification ");
stb.append(" ");
for (int i=0; i"+t.getName()+" ");
if (t.isSuccessfull()){
stb.append("Failed Successfull ");
}else {
stb.append("Successfull Failed ");
}
stb.append("");
}
stb.append("
");
} else {
stb.append("None of the tests has changed of success status.
");
}
return stb.toString();
}
}