use of org.jenkinsci.test.acceptance.plugins.warnings.WarningsAction in project acceptance-test-harness by jenkinsci.
the class WarningsPluginTest method should_not_skip_failed_builds_with_option_run_always.
/**
* Checks that the warnings plugin will not skip build results if "Run always" is checked.
*/
@Test
@Issue("28479")
@Ignore("Reactivate after JENKINS-28479 has been fixed.")
public void should_not_skip_failed_builds_with_option_run_always() {
FreeStyleJob job = runBuildWithRunAlwaysOption(true);
Build build = buildJobAndWait(job).shouldFail();
assertThatActionExists(job, build, "Java Warnings");
WarningsAction action = createJavaResultAction(build);
assertThatWarningsCountInSummaryIs(action, 131);
assertThatNewWarningsCountInSummaryIs(action, 131);
}
use of org.jenkinsci.test.acceptance.plugins.warnings.WarningsAction in project acceptance-test-harness by jenkinsci.
the class WarningsPluginTest method should_resolve_workspace_files.
/**
* Verifies that Jenkins scans the workspace for all available files to resolve relative paths
* of files with warnings when the option 'resolve-relative-paths' is enabled.
*/
@Test
@Issue("JENKINS-32150")
@WithPlugins("analysis-core@1.76")
public void should_resolve_workspace_files() {
FreeStyleJob job = createFreeStyleJob(RESOURCES + "jenkins-32150", settings -> {
settings.addWorkspaceScanner(CLANG_ID, "**/compile-log.txt");
settings.setCanResolveRelativePaths(true);
});
Build build = buildSuccessfulJob(job);
assertThatActionExists(job, build, "LLVM/Clang Warnings");
build.open();
int count = 10;
assertThat(driver, hasContent("LLVM/Clang Warnings: " + count));
WarningsAction action = new WarningsAction(build, "LLVM/Clang", "Clang (LLVM based)");
assertThatWarningsCountInSummaryIs(action, count);
assertThatNewWarningsCountInSummaryIs(action, count);
action.open();
assertThat(action.getNumberOfWarnings(), is(count));
assertThat(action.getNumberOfNewWarnings(), is(count));
assertThat(action.getNumberOfFixedWarnings(), is(0));
assertThat(action.getNumberOfWarningsWithHighPriority(), is(0));
assertThat(action.getNumberOfWarningsWithNormalPriority(), is(count));
assertThat(action.getNumberOfWarningsWithLowPriority(), is(0));
assertThatFilesTabIsCorrectlyFilled(action);
assertThatWarningsTabIsCorrectlyFilled(action);
verifySourceLine(action, "file-in-subdir.txt", 2, "02 EXAMPLE IN SUBDIR", "Some other warning");
verifySourceLine(action, "file.txt", 6, "06 EXAMPLE", "Some warning SECOND");
// Since multi-file-in-subdir.txt is contained twice in the workspace no source code is resolved
verifySourceLine(action, "multi-file-in-subdir.txt", 3, "03 Is the file 'multi-file-in-subdir.txt' contained more than once in your workspace?", "Another warning");
}
use of org.jenkinsci.test.acceptance.plugins.warnings.WarningsAction in project acceptance-test-harness by jenkinsci.
the class WarningsPluginTest method should_override_tab_name_with_groovy_parser.
/**
* Checks that a dynamic Groovy parser can override package tab title.
*/
@Test
@WithPlugins("analysis-core@1.91")
public void should_override_tab_name_with_groovy_parser() {
String parserName = createParser(OVERRIDE_PARSER_SCRIPT);
FreeStyleJob job = createFreeStyleJob(RESOURCES + GROOVY_TWO_LINES_FILE_NAME, settings -> settings.addWorkspaceScanner(parserName, "**/" + GROOVY_TWO_LINES_FILE_NAME));
Build build = buildSuccessfulJob(job);
WarningsAction action = createJavaResultAction(build);
action.open();
assertThat(driver, hasContent("DEAD_A"));
assertThat(driver, hasContent("DEAD_B"));
assertThat(driver, hasContent("BEEF"));
assertThat(driver.getPageSource(), containsString("<div id=\"packages\">BEEFs</div>"));
}
use of org.jenkinsci.test.acceptance.plugins.warnings.WarningsAction in project acceptance-test-harness by jenkinsci.
the class WarningsPluginTest method should_scan_console_log_of_slave_build.
@Test
@WithDocker
@WithCredentials(credentialType = WithCredentials.SSH_USERNAME_PRIVATE_KEY, values = { CREDENTIALS_ID, CREDENTIALS_KEY })
@WithPlugins("ssh-slaves")
public void should_scan_console_log_of_slave_build() throws ExecutionException, InterruptedException {
DumbSlave dockerSlave = createDockerAgent();
FreeStyleJob job = prepareDockerSlave(dockerSlave);
job.configure();
job.copyResource(resource(RESOURCE_WARNING_MAIN_JAVA_PATH));
ShellBuildStep shellBuildStep = job.addBuildStep(ShellBuildStep.class);
shellBuildStep.command(CMD_WARNING_MAIN_JAVA_CONSOLE);
WarningsPublisher warningsPublisher = job.addPublisher(WarningsPublisher.class);
warningsPublisher.addConsoleScanner(JAVA_ID);
job.save();
Build build = job.startBuild().shouldSucceed();
assertThatActionExists(job, build, "Java Warnings");
WarningsAction action = createJavaResultAction(build);
assertThatWarningsCountInSummaryIs(action, 3);
String codeLine = action.getLinkedSourceFileText(AnalysisAction.Tab.DETAILS, "WarningMain.java", 10);
String[] codeLineArr = codeLine.trim().split("\\s+", 2);
assertThat("Warning should be at line", codeLineArr[0], is("10"));
assertThat("Assert failed comparing code line is", codeLineArr[1], is("text = (TextClass) text2;"));
}
use of org.jenkinsci.test.acceptance.plugins.warnings.WarningsAction in project acceptance-test-harness by jenkinsci.
the class WarningsPluginTest method should_handle_invalid_ulr_gracefully.
/**
* Verifies that providing a wrong URL to the detail factories should navigate to the top-level page.
*/
@Test
@Issue("JENKINS-37195")
public void should_handle_invalid_ulr_gracefully() {
FreeStyleJob job = createFreeStyleJob(settings -> settings.addConsoleParser(JAVA_ID));
catWarningsToConsole(job);
buildSuccessfulJob(job);
WarningsAction action = createJavaProjectAction(job);
action.open();
visitLastPackage();
String packageRegex = "package.-?\\d+";
driver.get(driver.getCurrentUrl().replaceAll(packageRegex, "package.01234"));
assertThat(driver, hasContent("Aggregated Compiler Warnings"));
visitLastPackage();
driver.get(driver.getCurrentUrl().replaceAll(packageRegex, "package.NO_NUMBER"));
assertThat(driver, hasContent("Aggregated Compiler Warnings"));
visitLastPackage();
List<WebElement> fileLinks = all(by.xpath("//table[@id='files']//td[@class='pane']//a"));
int size = fileLinks.size();
assertThat(size, is(5));
fileLinks.get(size - 1).click();
assertThat(driver, hasContent("tmp/clover55196.tmp/net/sourceforge/pmd/renderers - File YAHTMLRenderer.java"));
driver.get(driver.getCurrentUrl().replaceAll("file.-?\\d+", "file.NO_NUMBER"));
assertThat(driver, hasContent("Compiler Warnings - Source Folder tmp/clover55196.tmp/net/sourceforge/pmd/renderers"));
}
Aggregations