Search in sources :

Example 1 with TestResult

use of hudson.tasks.test.TestResult in project hudson-2.x by hudson.

the class History method getDurationGraph.

/**
     * Graph of duration of tests over time.
     */
public Graph getDurationGraph() {
    return new GraphImpl("seconds") {

        protected DataSetBuilder<String, ChartLabel> createDataSet() {
            DataSetBuilder<String, ChartLabel> data = new DataSetBuilder<String, ChartLabel>();
            List<TestResult> list;
            try {
                list = getList(Integer.parseInt(Stapler.getCurrentRequest().getParameter("start")), Integer.parseInt(Stapler.getCurrentRequest().getParameter("end")));
            } catch (NumberFormatException e) {
                list = getList();
            }
            for (hudson.tasks.test.TestResult o : list) {
                data.add(((double) o.getDuration()) / (1000), "", new ChartLabel(o) {

                    @Override
                    public Color getColor() {
                        if (o.getFailCount() > 0)
                            return ColorPalette.RED;
                        else if (o.getSkipCount() > 0)
                            return ColorPalette.YELLOW;
                        else
                            return ColorPalette.BLUE;
                    }
                });
            }
            return data;
        }
    };
}
Also used : Color(java.awt.Color) DataSetBuilder(hudson.util.DataSetBuilder) TestResult(hudson.tasks.test.TestResult) TestResult(hudson.tasks.test.TestResult)

Example 2 with TestResult

use of hudson.tasks.test.TestResult in project hudson-2.x by hudson.

the class History method getCountGraph.

/**
     * Graph of # of tests over time.
     */
public Graph getCountGraph() {
    return new GraphImpl("") {

        protected DataSetBuilder<String, ChartLabel> createDataSet() {
            DataSetBuilder<String, ChartLabel> data = new DataSetBuilder<String, ChartLabel>();
            List<TestResult> list;
            try {
                list = getList(Integer.parseInt(Stapler.getCurrentRequest().getParameter("start")), Integer.parseInt(Stapler.getCurrentRequest().getParameter("end")));
            } catch (NumberFormatException e) {
                list = getList();
            }
            for (TestResult o : list) {
                data.add(o.getPassCount(), "2Passed", new ChartLabel(o));
                data.add(o.getFailCount(), "1Failed", new ChartLabel(o));
                data.add(o.getSkipCount(), "0Skipped", new ChartLabel(o));
            }
            return data;
        }
    };
}
Also used : DataSetBuilder(hudson.util.DataSetBuilder) TestResult(hudson.tasks.test.TestResult)

Example 3 with TestResult

use of hudson.tasks.test.TestResult in project hudson-2.x by hudson.

the class History method getList.

public List<TestResult> getList(int start, int end) {
    List<TestResult> list = new ArrayList<TestResult>();
    end = Math.min(end, testObject.getOwner().getParent().getBuilds().size());
    for (AbstractBuild<?, ?> b : testObject.getOwner().getParent().getBuilds().subList(start, end)) {
        if (b.isBuilding())
            continue;
        TestResult o = testObject.getResultInBuild(b);
        if (o != null) {
            list.add(o);
        }
    }
    return list;
}
Also used : ArrayList(java.util.ArrayList) TestResult(hudson.tasks.test.TestResult)

Aggregations

TestResult (hudson.tasks.test.TestResult)3 DataSetBuilder (hudson.util.DataSetBuilder)2 Color (java.awt.Color)1 ArrayList (java.util.ArrayList)1