Search in sources :

Example 1 with FindBugsAction

use of org.jenkinsci.test.acceptance.plugins.findbugs.FindBugsAction in project acceptance-test-harness by jenkinsci.

the class FindBugsPluginTest method should_retrieve_results_from_maven_job.

/**
 * Builds a maven project and checks if a new warning is displayed.
 */
@Test
public void should_retrieve_results_from_maven_job() {
    MavenModuleSet job = createMavenJob();
    Build build = buildSuccessfulJob(job);
    assertThatFindBugsResultExists(job, build);
    build.open();
    FindBugsAction action = new FindBugsAction(build);
    action.open();
    assertThat(action.getNumberOfNewWarnings(), is(1));
}
Also used : FindBugsAction(org.jenkinsci.test.acceptance.plugins.findbugs.FindBugsAction) Build(org.jenkinsci.test.acceptance.po.Build) MavenModuleSet(org.jenkinsci.test.acceptance.plugins.maven.MavenModuleSet) Test(org.junit.Test)

Example 2 with FindBugsAction

use of org.jenkinsci.test.acceptance.plugins.findbugs.FindBugsAction in project acceptance-test-harness by jenkinsci.

the class FindBugsPluginTest method should_link_to_source_code_in_real_project.

/**
 * Builds a freestyle project and checks if new warning are displayed.
 */
@Test
public void should_link_to_source_code_in_real_project() {
    FreeStyleJob job = createJob(jenkins, "/findbugs_plugin/sample_findbugs_project", FreeStyleJob.class, FindBugsFreestyleSettings.class, settings -> settings.pattern.set("target/findbugsXml.xml"));
    setMavenGoal(job, "clean package findbugs:findbugs");
    Build build = buildSuccessfulJob(job);
    assertThatFindBugsResultExists(job, build);
    build.open();
    FindBugsAction action = new FindBugsAction(build);
    action.open();
    assertThat(action.getNumberOfNewWarnings(), is(1));
    verifySourceLine(action, "Main.java", 18, "18         if(o == null) {", "Redundant nullcheck of o, which is known to be non-null in Main.main(String[])");
}
Also used : FindBugsAction(org.jenkinsci.test.acceptance.plugins.findbugs.FindBugsAction) Build(org.jenkinsci.test.acceptance.po.Build) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) Test(org.junit.Test)

Example 3 with FindBugsAction

use of org.jenkinsci.test.acceptance.plugins.findbugs.FindBugsAction in project acceptance-test-harness by jenkinsci.

the class FindBugsPluginTest method verifyWarningCounts.

private void verifyWarningCounts(final Build build) {
    FindBugsAction action = new FindBugsAction(build);
    assertThatWarningsCountInSummaryIs(action, 5);
    assertThatNewWarningsCountInSummaryIs(action, 1);
    assertThatFixedWarningsCountInSummaryIs(action, 2);
    action.open();
    assertThat(action.getNumberOfWarnings(), is(5));
    assertThat(action.getNumberOfNewWarnings(), is(1));
    assertThat(action.getNumberOfFixedWarnings(), is(2));
    assertThat(action.getNumberOfWarningsWithHighPriority(), is(3));
    assertThat(action.getNumberOfWarningsWithNormalPriority(), is(2));
    assertThat(action.getNumberOfWarningsWithLowPriority(), is(0));
    action.openNew();
    assertThat(action.getNumberOfWarningsWithHighPriority(), is(1));
    assertThat(action.getNumberOfWarningsWithNormalPriority(), is(0));
    assertThat(action.getNumberOfWarningsWithLowPriority(), is(0));
    action.openFixed();
    assertThat(action.getNumberOfRowsInFixedWarningsTable(), is(2));
}
Also used : FindBugsAction(org.jenkinsci.test.acceptance.plugins.findbugs.FindBugsAction)

Aggregations

FindBugsAction (org.jenkinsci.test.acceptance.plugins.findbugs.FindBugsAction)3 Build (org.jenkinsci.test.acceptance.po.Build)2 Test (org.junit.Test)2 MavenModuleSet (org.jenkinsci.test.acceptance.plugins.maven.MavenModuleSet)1 FreeStyleJob (org.jenkinsci.test.acceptance.po.FreeStyleJob)1