use of org.jenkinsci.test.acceptance.po.Build in project acceptance-test-harness by jenkinsci.
the class PmdPluginTest method should_find_no_warnings.
/**
* Configures a job with PMD and checks that the parsed PMD file does not contain warnings.
*/
@Test
public void should_find_no_warnings() {
FreeStyleJob job = createFreeStyleJob(settings -> settings.pattern.set(PATTERN_WITHOUT_WARNINGS));
Build lastBuild = buildSuccessfulJob(job);
assertThatBuildHasNoWarnings(lastBuild);
}
use of org.jenkinsci.test.acceptance.po.Build in project acceptance-test-harness by jenkinsci.
the class PmdPluginTest method should_retrieve_results_from_maven_job.
/**
* Builds a maven project and checks if new warnings are displayed.
*/
@Test
public void should_retrieve_results_from_maven_job() {
MavenModuleSet job = createMavenJob();
Build build = buildSuccessfulJob(job);
assertThatPmdResultExists(job, build);
build.open();
PmdAction action = new PmdAction(build);
action.open();
assertThat(action.getNumberOfNewWarnings(), is(2));
}
use of org.jenkinsci.test.acceptance.po.Build in project acceptance-test-harness by jenkinsci.
the class PmdPluginTest method should_report_new_and_fixed_warnings_in_consecutive_builds.
/**
* Runs job two times to check if new and fixed warnings are displayed. Afterwards, the first build
* is deleted and Jenkins is restarted. Then the results of the second build are validated again: the detail
* pages should then show the same results (see JENKINS-24940).
*/
@Test
@Issue("24940")
public void should_report_new_and_fixed_warnings_in_consecutive_builds() {
assumeTrue("This test requires a restartable Jenkins", jenkins.canRestart());
FreeStyleJob job = createFreeStyleJob();
Build firstBuild = buildJobAndWait(job);
editJob(PLUGIN_ROOT + "forSecondRun/pmd-warnings.xml", false, job, PmdFreestyleSettings.class);
Build lastBuild = buildSuccessfulJob(job);
assertThatPmdResultExists(job, lastBuild);
lastBuild.open();
verifyWarningCounts(lastBuild);
firstBuild.delete();
jenkins.restart();
lastBuild.open();
verifyWarningCounts(lastBuild);
}
use of org.jenkinsci.test.acceptance.po.Build in project acceptance-test-harness by jenkinsci.
the class PostBuildScriptPluginTest method skip_for_jobs_that_failed.
@Test
public void skip_for_jobs_that_failed() {
j.configure();
j.addShellStep("exit 1");
addMarkerPostBuildStep().runWhenSucceeded();
j.save();
Build build = j.startBuild().shouldFail();
assertThat(build, not(runPostBuildStep()));
}
use of org.jenkinsci.test.acceptance.po.Build in project acceptance-test-harness by jenkinsci.
the class TaskScannerPluginTest method should_report_closed_tasks.
/**
* Verifies the detection of closed tasks. Therefore two runs of the same job with the same task scanner setup are
* conducted but the fileset in the workspace will be replaced by the same files containing less warnings for the
* second run. The tasks that have been removed shall be correctly listed as closed tasks.
*/
@Test
public void should_report_closed_tasks() throws Exception {
FreeStyleJob job = createFreeStyleJob(settings -> {
settings.setPattern("**/*.java");
settings.setExcludePattern("**/*Test.java");
settings.setHighPriorityTags("FIXME");
settings.setNormalPriorityTags("TODO");
settings.setLowPriorityTags("@Deprecated");
settings.setIgnoreCase(false);
});
buildSuccessfulJob(job);
// this time we do not check the task scanner output as the result is the same
// as for single_task_tags_and_exclusion_pattern
// So we proceed directly with the preparation of build #2
editJob("/tasks_plugin/fileset1_less", false, job, TasksFreestyleSettings.class);
Build build = buildSuccessfulJob(job);
build.open();
TaskScannerAction action = new TaskScannerAction(build);
// In the first build the task priorities were
// - 1x high
// - 4x medium
// - 1x low
//
// For the second build (reduced warnings) the expected priorities are
// - 3x medium
//
// --> we expect 3 closed tasks (1x high, 1x normal, 1x low)
assertThatOpenTaskCountLinkIs(action, 3, 7);
assertThatClosedTaskCountLinkIs(action, 3);
action.open();
assertThat(action.getNumberOfWarnings(), is(3));
assertThat(action.getNumberOfFixedWarnings(), is(3));
assertThat(action.getNumberOfWarningsWithHighPriority(), is(0));
assertThat(action.getNumberOfWarningsWithNormalPriority(), is(3));
assertThat(action.getNumberOfWarningsWithLowPriority(), is(0));
assertFixedTab(action);
}
Aggregations