Search in sources :

Example 1 with AnalysisCollectorAction

use of org.jenkinsci.test.acceptance.plugins.analysis_collector.AnalysisCollectorAction in project acceptance-test-harness by jenkinsci.

the class AnalysisCollectorPluginTest method should_collect_warnings_of_selected_tools_only.

/**
 * Verifies that the plugin only collects warnings of the checked plugins. The test starts with a build that
 * collects the warnings of all available tools. Then subsequently a new build is started with one tool removed
 * until no tool is checked anymore.
 */
@Test
public void should_collect_warnings_of_selected_tools_only() {
    FreeStyleJob job = createFreeStyleJob();
    int remaining = TOTAL;
    AnalysisCollectorAction action = deselectPluginAndBuild(CHECKSTYLE, job);
    remaining -= CHECKSTYLE_ALL;
    assertThat(action.getNumberOfWarnings(), is(remaining));
    action = deselectPluginAndBuild(FINDBUGS, job);
    remaining -= FINDBUGS_ALL;
    assertThat(action.getNumberOfWarnings(), is(remaining));
    action = deselectPluginAndBuild(PMD, job);
    remaining -= PMD_ALL;
    assertThat(action.getNumberOfWarnings(), is(remaining));
    action = deselectPluginAndBuild(TASKS, job);
    remaining -= TASKS_ALL;
    assertThat(action.getNumberOfWarnings(), is(remaining));
    action = deselectPluginAndBuild(WARNINGS, job);
    assertThat(action.getNumberOfWarnings(), is(0));
}
Also used : AnalysisCollectorAction(org.jenkinsci.test.acceptance.plugins.analysis_collector.AnalysisCollectorAction) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) Test(org.junit.Test)

Example 2 with AnalysisCollectorAction

use of org.jenkinsci.test.acceptance.plugins.analysis_collector.AnalysisCollectorAction in project acceptance-test-harness by jenkinsci.

the class AnalysisCollectorPluginTest method should_compute_all_new_open_tasks.

/**
 * Verifies that the plugin correctly identifies new open tasks. The first build contains 4 open tasks. The second
 * builds adds another 4 open tasks, summing up to a total of 8 open tasks. The second build should then contain 4
 * new warnings.
 */
@Test
public void should_compute_all_new_open_tasks() {
    FreeStyleJob job = createJob(ANALYSIS_COLLECTOR_PLUGIN_RESOURCES + "/Tasks.java", true);
    buildSuccessfulJob(job);
    job.configure();
    job.copyResource(ANALYSIS_COLLECTOR_PLUGIN_RESOURCES + "/Tasks2.java");
    job.save();
    Build build = buildSuccessfulJob(job);
    AnalysisCollectorAction action = new AnalysisCollectorAction(build);
    action.open();
    assertThat(action.getNumberOfWarnings(), is(8));
    assertThat(action.getNumberOfWarningsWithHighPriority(), is(2));
    assertThat(action.getNumberOfWarningsWithNormalPriority(), is(4));
    assertThat(action.getNumberOfWarningsWithLowPriority(), is(2));
    assertThat(action.getNumberOfNewWarnings(), is(4));
}
Also used : Build(org.jenkinsci.test.acceptance.po.Build) AnalysisCollectorAction(org.jenkinsci.test.acceptance.plugins.analysis_collector.AnalysisCollectorAction) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) Test(org.junit.Test)

Example 3 with AnalysisCollectorAction

use of org.jenkinsci.test.acceptance.plugins.analysis_collector.AnalysisCollectorAction in project acceptance-test-harness by jenkinsci.

the class AnalysisCollectorPluginTest method deselectPluginAndBuild.

private AnalysisCollectorAction deselectPluginAndBuild(AnalysisPlugin plugin, Job job) {
    job.configure();
    AnalysisCollectorSettings publisher = job.getPublisher(AnalysisCollectorSettings.class);
    publisher.checkCollectedPlugin(plugin, false);
    job.save();
    Build build = buildSuccessfulJob(job);
    AnalysisCollectorAction action = new AnalysisCollectorAction(build);
    action.open();
    return action;
}
Also used : Build(org.jenkinsci.test.acceptance.po.Build) AnalysisCollectorAction(org.jenkinsci.test.acceptance.plugins.analysis_collector.AnalysisCollectorAction) AnalysisCollectorSettings(org.jenkinsci.test.acceptance.plugins.analysis_collector.AnalysisCollectorSettings)

Example 4 with AnalysisCollectorAction

use of org.jenkinsci.test.acceptance.plugins.analysis_collector.AnalysisCollectorAction in project acceptance-test-harness by jenkinsci.

the class AnalysisCollectorPluginTest method should_compute_annotations_on_workflow.

@Test
@WithPlugins("workflow-aggregator")
public void should_compute_annotations_on_workflow() {
    WorkflowJob job = jenkins.jobs.create(WorkflowJob.class);
    job.script.set("node {\n" + copyFileToWorkspace(job, "checkstyle-result.xml") + copyFileToWorkspace(job, "findbugs.xml") + "  step([$class: 'FindBugsPublisher', pattern: '**/findbugs.xml'])\n" + "  step([$class: 'CheckStylePublisher'])\n" + "  step([$class: 'AnalysisPublisher'])\n" + "}");
    job.sandbox.check();
    job.save();
    final Build build = job.startBuild();
    build.shouldSucceed();
    assertThat(build, hasAction("Static Analysis Warnings"));
    AnalysisCollectorAction action = new AnalysisCollectorAction(build);
    action.open();
    assertThat(action.getNumberOfWarnings(), is(FINDBUGS_ALL + CHECKSTYLE_ALL));
    assertThat(action.getNumberOfNewWarnings(), is(FINDBUGS_ALL + CHECKSTYLE_ALL));
}
Also used : Build(org.jenkinsci.test.acceptance.po.Build) AnalysisCollectorAction(org.jenkinsci.test.acceptance.plugins.analysis_collector.AnalysisCollectorAction) WorkflowJob(org.jenkinsci.test.acceptance.po.WorkflowJob) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins)

Example 5 with AnalysisCollectorAction

use of org.jenkinsci.test.acceptance.plugins.analysis_collector.AnalysisCollectorAction in project acceptance-test-harness by jenkinsci.

the class AnalysisCollectorPluginTest method should_deactivate_all_other_trend_graphs.

/**
 * Verifies that no other trend graphs are shown if configured in the graph configuration screen per user.
 */
@Test
@Issue("JENKINS-30270")
public void should_deactivate_all_other_trend_graphs() {
    FreeStyleJob job = createFreeStyleJob();
    buildSuccessfulJob(job);
    buildSuccessfulJob(job);
    job.open();
    elasticSleep(500);
    assertThatNumberOfGraphsIs(job, 48);
    AnalysisCollectorAction action = new AnalysisCollectorAction(job);
    AnalysisGraphConfigurationView view = action.configureTrendGraphForUser();
    deactivateOtherTrendGraphs(view, true);
    assertThatNumberOfGraphsIs(job, 6);
    deactivateOtherTrendGraphs(view, false);
    assertThatNumberOfGraphsIs(job, 48);
}
Also used : AnalysisGraphConfigurationView(org.jenkinsci.test.acceptance.plugins.analysis_collector.AnalysisGraphConfigurationView) AnalysisCollectorAction(org.jenkinsci.test.acceptance.plugins.analysis_collector.AnalysisCollectorAction) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) Issue(org.jvnet.hudson.test.Issue) Test(org.junit.Test)

Aggregations

AnalysisCollectorAction (org.jenkinsci.test.acceptance.plugins.analysis_collector.AnalysisCollectorAction)5 Test (org.junit.Test)4 Build (org.jenkinsci.test.acceptance.po.Build)3 FreeStyleJob (org.jenkinsci.test.acceptance.po.FreeStyleJob)3 WithPlugins (org.jenkinsci.test.acceptance.junit.WithPlugins)1 AnalysisCollectorSettings (org.jenkinsci.test.acceptance.plugins.analysis_collector.AnalysisCollectorSettings)1 AnalysisGraphConfigurationView (org.jenkinsci.test.acceptance.plugins.analysis_collector.AnalysisGraphConfigurationView)1 WorkflowJob (org.jenkinsci.test.acceptance.po.WorkflowJob)1 Issue (org.jvnet.hudson.test.Issue)1