use of org.jenkinsci.test.acceptance.plugins.warnings.WarningsAction in project acceptance-test-harness by jenkinsci.
the class WarningsPluginTest method assertThatConfigurationTabIsCorrectlyFilled.
private void assertThatConfigurationTabIsCorrectlyFilled(final MatrixProject job) {
SortedMap<String, Integer> expectedConfigurationDetails = new TreeMap<>();
expectedConfigurationDetails.put("user_axis=one", 4);
expectedConfigurationDetails.put("user_axis=two", 6);
expectedConfigurationDetails.put("user_axis=three", 2);
WarningsAction action = createJavaProjectAction(job);
assertThat(action.getModulesTabContents(), is(expectedConfigurationDetails));
}
use of org.jenkinsci.test.acceptance.plugins.warnings.WarningsAction in project acceptance-test-harness by jenkinsci.
the class WarningsPluginTest method should_detect_errors_in_console_log.
/**
* Checks whether the warnings plugin finds one Maven warning in the console log. The result should be a build with
* 1 Maven Warning.
*/
@Test
public void should_detect_errors_in_console_log() {
FreeStyleJob job = createNoFilesFreeStyleJob(settings -> settings.addConsoleParser("Maven"));
job.configure();
job.addShellStep("mvn clean install || true");
job.save();
Build build = buildSuccessfulJob(job);
assertThatActionExists(job, build, "Maven Warnings");
WarningsAction action = new WarningsAction(build, "Maven", "Maven");
assertThatWarningsCountInSummaryIs(action, 1);
assertThatNewWarningsCountInSummaryIs(action, 1);
action.open();
assertThat(action.getNumberOfNewWarnings(), is(1));
assertThat(action.getNumberOfWarnings(), is(1));
assertThat(action.getNumberOfFixedWarnings(), is(0));
assertThat(action.getNumberOfWarningsWithHighPriority(), is(1));
assertThat(action.getNumberOfWarningsWithNormalPriority(), is(0));
assertThat(action.getNumberOfWarningsWithLowPriority(), is(0));
}
use of org.jenkinsci.test.acceptance.plugins.warnings.WarningsAction in project acceptance-test-harness by jenkinsci.
the class WarningsPluginTest method should_have_correct_details.
@Test
@WithDocker
@WithCredentials(credentialType = WithCredentials.SSH_USERNAME_PRIVATE_KEY, values = { CREDENTIALS_ID, CREDENTIALS_KEY })
@WithPlugins("ssh-slaves")
public void should_have_correct_details() throws ExecutionException, InterruptedException {
WarningsAction action = createAndBuildCompileJobOnAgent(resource("/warnings_plugin/WarningMain.java"), "javac -Xlint:all WarningMain.java");
SortedMap<String, String> details = action.getDetailsTabContents();
assertThat("Assert the proper detail count.", details.entrySet(), hasSize(3));
assertThatDetailsAre(details, "redundant cast to TextClass", "WarningMain.java:10");
// removing tested entry from details.
details.remove(details.firstKey());
assertThatDetailsAre(details, "redundant cast to TextClass", "WarningMain.java:11");
// removing tested entry from details.
details.remove(details.firstKey());
assertThatDetailsAre(details, "division by zero", "WarningMain.java:14");
}
use of org.jenkinsci.test.acceptance.plugins.warnings.WarningsAction in project acceptance-test-harness by jenkinsci.
the class WarningsPluginTest method should_include_warnings_specified_in_included_parts.
/**
* Checks whether the warnings plugin picks only specific warnings. The warnings to include are given by two include
* patterns {".*include.*", ".*default.*"}. The result should be a build with 5 Java Warnings (from a file that
* contains 9 warnings).
*/
@Test
public void should_include_warnings_specified_in_included_parts() {
FreeStyleJob job = createFreeStyleJob(WARNINGS_FILE_FOR_INCLUDE_EXCLUDE_TESTS, settings -> {
settings.addWorkspaceScanner(JAVA_TITLE, "**/*");
settings.setIncludePattern(".*/include*/.*, .*/default/.*");
});
Build build = buildSuccessfulJob(job);
assertThatActionExists(job, build, "Java Warnings");
WarningsAction action = createJavaResultAction(build);
assertThatWarningsCountInSummaryIs(action, 5);
assertThatNewWarningsCountInSummaryIs(action, 5);
action.open();
assertThat(action.getNumberOfWarnings(), is(5));
assertThat(action.getNumberOfNewWarnings(), is(5));
assertThat(action.getNumberOfFixedWarnings(), is(0));
assertThat(action.getNumberOfWarningsWithHighPriority(), is(0));
assertThat(action.getNumberOfWarningsWithNormalPriority(), is(5));
assertThat(action.getNumberOfWarningsWithLowPriority(), is(0));
}
Aggregations