Search in sources :

Example 1 with BuildStatisticsPortlet

use of org.jenkinsci.test.acceptance.plugins.dashboard_view.BuildStatisticsPortlet in project acceptance-test-harness by jenkinsci.

the class DashboardViewPluginTest method buildStatisticsPortlet_unstableNr.

@Test
public void buildStatisticsPortlet_unstableNr() {
    DashboardView v = createDashboardView();
    BuildStatisticsPortlet stats = v.addBottomPortlet(BuildStatisticsPortlet.class);
    v.save();
    buildUnstableJob(createUnstableFreeStyleJob());
    v.open();
    assertThat(stats.getNumberOfBuilds(JobType.UNSTABLE), is(1));
}
Also used : BuildStatisticsPortlet(org.jenkinsci.test.acceptance.plugins.dashboard_view.BuildStatisticsPortlet) DashboardView(org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView) Test(org.junit.Test)

Example 2 with BuildStatisticsPortlet

use of org.jenkinsci.test.acceptance.plugins.dashboard_view.BuildStatisticsPortlet in project acceptance-test-harness by jenkinsci.

the class DashboardViewPluginTest method buildStatisticsPortlet_totalBuilds.

@Test
public void buildStatisticsPortlet_totalBuilds() {
    DashboardView v = createDashboardView();
    BuildStatisticsPortlet stats = v.addBottomPortlet(BuildStatisticsPortlet.class);
    v.save();
    FreeStyleJob successJob = createFreeStyleJob();
    FreeStyleJob failingJob = createFailingFreeStyleJob();
    FreeStyleJob unstableJob = createUnstableFreeStyleJob();
    buildUnstableJob(unstableJob);
    buildSuccessfulJob(successJob);
    buildSuccessfulJob(successJob);
    buildFailingJob(failingJob);
    v.open();
    assertThat(stats.getNumberOfBuilds(JobType.TOTAL), is(4));
}
Also used : BuildStatisticsPortlet(org.jenkinsci.test.acceptance.plugins.dashboard_view.BuildStatisticsPortlet) DashboardView(org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) Test(org.junit.Test)

Example 3 with BuildStatisticsPortlet

use of org.jenkinsci.test.acceptance.plugins.dashboard_view.BuildStatisticsPortlet in project acceptance-test-harness by jenkinsci.

the class DashboardViewPluginTest method buildStatisticsPortlet_success.

@Test
public void buildStatisticsPortlet_success() {
    DashboardView v = createDashboardView();
    BuildStatisticsPortlet stats = v.addBottomPortlet(BuildStatisticsPortlet.class);
    v.save();
    buildSuccessfulJob(createFreeStyleJob());
    v.open();
    assertThat(stats.getNumberOfBuilds(JobType.SUCCESS), is(1));
}
Also used : BuildStatisticsPortlet(org.jenkinsci.test.acceptance.plugins.dashboard_view.BuildStatisticsPortlet) DashboardView(org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView) Test(org.junit.Test)

Example 4 with BuildStatisticsPortlet

use of org.jenkinsci.test.acceptance.plugins.dashboard_view.BuildStatisticsPortlet in project acceptance-test-harness by jenkinsci.

the class DashboardViewPluginTest method configureDashboardFilterOnlyActivatedJobs.

@Test
public void configureDashboardFilterOnlyActivatedJobs() {
    DashboardView v = createDashboardView();
    BuildStatisticsPortlet stats = v.addBottomPortlet(BuildStatisticsPortlet.class);
    v.configure(() -> {
        v.jobFilters.setStatusFilter(JobFiltersArea.StatusFilter.ENABLED);
    });
    final FreeStyleJob active = createFreeStyleJob();
    final FreeStyleJob disabled = createFreeStyleJob();
    buildSuccessfulJob(active);
    buildSuccessfulJob(disabled);
    v.open();
    assertThat(stats.getNumberOfBuilds(JobType.TOTAL), is(2));
    assertThat(stats.getNumberOfBuilds(JobType.DISABLED), is(0));
    disabled.configure(disabled::disable);
    v.open();
    assertThat(stats.getNumberOfBuilds(JobType.TOTAL), is(1));
    assertThat(stats.getNumberOfBuilds(JobType.DISABLED), is(0));
}
Also used : BuildStatisticsPortlet(org.jenkinsci.test.acceptance.plugins.dashboard_view.BuildStatisticsPortlet) DashboardView(org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) Test(org.junit.Test)

Example 5 with BuildStatisticsPortlet

use of org.jenkinsci.test.acceptance.plugins.dashboard_view.BuildStatisticsPortlet in project acceptance-test-harness by jenkinsci.

the class DashboardViewPluginTest method buildStatisticsPortlet_Percentage.

@Test
public void buildStatisticsPortlet_Percentage() {
    DashboardView v = createDashboardView();
    BuildStatisticsPortlet stats = v.addBottomPortlet(BuildStatisticsPortlet.class);
    v.save();
    FreeStyleJob success = createFreeStyleJob();
    FreeStyleJob failing = createFailingFreeStyleJob();
    FreeStyleJob unstable = createUnstableFreeStyleJob();
    buildSuccessfulJob(success);
    v.open();
    assertThat(stats.getPercentageOfBuilds(JobType.SUCCESS), is("100.0"));
    buildFailingJob(failing);
    v.open();
    assertThat(stats.getPercentageOfBuilds(JobType.SUCCESS), is("50.0"));
    assertThat(stats.getPercentageOfBuilds(JobType.FAILED), is("50.0"));
    buildFailingJob(failing);
    v.open();
    assertThat(stats.getPercentageOfBuilds(JobType.SUCCESS), is("33.33"));
    assertThat(stats.getPercentageOfBuilds(JobType.FAILED), is("66.67"));
    buildUnstableJob(unstable);
    v.open();
    assertThat(stats.getPercentageOfBuilds(JobType.SUCCESS), is("25.0"));
    assertThat(stats.getPercentageOfBuilds(JobType.FAILED), is("50.0"));
    assertThat(stats.getPercentageOfBuilds(JobType.UNSTABLE), is("25.0"));
}
Also used : BuildStatisticsPortlet(org.jenkinsci.test.acceptance.plugins.dashboard_view.BuildStatisticsPortlet) DashboardView(org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) Test(org.junit.Test)

Aggregations

BuildStatisticsPortlet (org.jenkinsci.test.acceptance.plugins.dashboard_view.BuildStatisticsPortlet)7 DashboardView (org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView)7 Test (org.junit.Test)7 FreeStyleJob (org.jenkinsci.test.acceptance.po.FreeStyleJob)4 Ignore (org.junit.Ignore)1