use of org.jenkinsci.test.acceptance.plugins.maven.MavenModuleSet 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.plugins.maven.MavenModuleSet in project acceptance-test-harness by jenkinsci.
the class TaskScannerPluginTest method should_detect_regular_expression_in_maven_job.
/**
* Verifies that the plugin correctly works in maven jobs for tags that are treated as regular expression.
*/
@Test
public void should_detect_regular_expression_in_maven_job() throws Exception {
MavenModuleSet job = createMavenJob("/tasks_plugin/regexp", settings -> {
settings.setPattern("**/*.txt");
settings.setNormalPriorityTags("^.*(TODO(?:[0-9]*))(.*)$");
settings.setAsRegexp(true);
});
verifyRegularExpressionScannerResult(job);
}
use of org.jenkinsci.test.acceptance.plugins.maven.MavenModuleSet in project acceptance-test-harness by jenkinsci.
the class TaskScannerPluginTest method should_find_tasks_in_maven_project.
/**
* Verifies several task scanner functions for a maven project such as - treatment of exclusion pattern - correct
* counting of warnings - correct prioritisation of warnings - changing build status based on thresholds.
*/
@Test
public void should_find_tasks_in_maven_project() throws Exception {
MavenModuleSet job = createMavenJob("/tasks_plugin/sample_tasks_project", "clean package test", settings -> {
settings.setPattern("**/*.java");
settings.setExcludePattern("**/*Test.java");
settings.setHighPriorityTags("FIXME");
settings.setNormalPriorityTags("TODO");
settings.setLowPriorityTags("@Deprecated");
settings.setIgnoreCase(false);
});
// as one of the unit tests fail, the build should be unstable
Build build = buildUnstableJob(job);
assertThatTasksResultExists(job, build);
build.open();
TaskScannerAction action = new TaskScannerAction(build);
// The expected task priorities are:
// - 1x high
// - 1x medium
// - 1x low
assertThatOpenTaskCountLinkIs(action, 3, 1);
action.open();
assertThat(action.getNumberOfWarnings(), is(3));
assertThat(action.getNumberOfWarningsWithHighPriority(), is(1));
assertThat(action.getNumberOfWarningsWithNormalPriority(), is(1));
assertThat(action.getNumberOfWarningsWithLowPriority(), is(1));
// re-configure the job and set a threshold to mark the build as failed
editJob(false, job, TasksMavenSettings.class, settings -> {
settings.setBuildFailedTotalHigh("0");
settings.setBuildFailedTotalNormal("5");
settings.setBuildFailedTotalLow("10");
});
// as the threshold for high priority warnings is exceeded, the build should be marked as failed
build = buildFailingJob(job);
assertThatTasksResultExists(job, build);
build.open();
// check build result text
assertThat(action.getPluginResult(build), is("Plug-in Result: FAILED - 1 warning of priority High exceeds the threshold of 0 by 1 (Reference build: #1)"));
action.open();
// no change in warning counts expected
assertThat(action.getNumberOfWarningsWithHighPriority(), is(1));
assertThat(action.getNumberOfWarningsWithNormalPriority(), is(1));
assertThat(action.getNumberOfWarningsWithLowPriority(), is(1));
}
use of org.jenkinsci.test.acceptance.plugins.maven.MavenModuleSet 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));
}
use of org.jenkinsci.test.acceptance.plugins.maven.MavenModuleSet in project acceptance-test-harness by jenkinsci.
the class FindBugsPluginTest method should_set_result_to_failed_if_warning_found.
/**
* Builds a maven project and checks if it failed.
*/
@Test
public void should_set_result_to_failed_if_warning_found() {
MavenModuleSet job = createMavenJob(settings -> settings.setBuildFailedTotalAll("0"));
buildJobAndWait(job).shouldFail();
}
Aggregations