Search in sources :

Example 1 with FreeStyleJob

use of org.jenkinsci.test.acceptance.po.FreeStyleJob in project acceptance-test-harness by jenkinsci.

the class JdkTest method autoinstallJdk.

@Test
@TestActivation({ "ORACLE_LOGIN", "ORACLE_PASSWORD" })
public void autoinstallJdk() {
    final String login = System.getProperty("JdkTest.ORACLE_LOGIN");
    final String passwd = System.getProperty("JdkTest.ORACLE_PASSWORD");
    ToolInstallation.waitForUpdates(jenkins, JdkInstallation.class);
    JdkInstallation jdk = ToolInstallation.addTool(jenkins, JdkInstallation.class);
    jdk.name.set("jdk_1.8.0");
    jdk.installVersion("jdk-8u141-oth-JPR");
    jdk.getPage().save();
    jdk.setCredentials(login, passwd);
    FreeStyleJob job = jenkins.jobs.create();
    job.configure();
    job.addShellStep("java -version");
    job.save();
    int tenMinutes = 600000;
    job.startBuild().waitUntilFinished(tenMinutes).shouldSucceed().shouldContainsConsoleOutput("Installing JDK jdk-8u141-oth-JPR").shouldContainsConsoleOutput("Downloading JDK from http://download.oracle.com");
}
Also used : JdkInstallation(org.jenkinsci.test.acceptance.po.JdkInstallation) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) TestActivation(org.jenkinsci.test.acceptance.junit.TestActivation)

Example 2 with FreeStyleJob

use of org.jenkinsci.test.acceptance.po.FreeStyleJob in project acceptance-test-harness by jenkinsci.

the class AbstractAnalysisTest method should_send_mail_with_expanded_tokens.

/**
 * Checks that the plug-in sends a mail after a build has been failed. The content of the mail contains several
 * tokens that should be expanded in the mail with the correct values.
 */
// TODO: we should have two builds so that the numbers are different
@Test
@Issue("JENKINS-25501")
@WithPlugins("email-ext")
public void should_send_mail_with_expanded_tokens() {
    // avoid JENKINS-49026
    checkExtensionAreDeployed("hudson.plugins.analysis.tokens.AbstractTokenMacro", Collections.EMPTY_SET);
    setUpMailer();
    FreeStyleJob job = createFreeStyleJob();
    P projectAction = createProjectAction(job);
    job.editPublisher(projectAction.getFreeStyleSettings(), settings -> settings.setBuildFailedTotalAll("0"));
    String name = projectAction.getUrl().toUpperCase();
    String title = "Analysis-Result";
    configureEmailNotification(job, String.format("%s: ${%s_RESULT}", title, name), String.format("%s: ${%s_COUNT}-${%s_FIXED}-${%s_NEW}", title, name, name, name));
    buildFailingJob(job);
    verifyReceivedMail(String.format("%s: FAILURE", title), String.format("%s: %d-0-%d", title, getNumberOfWarnings(), getNumberOfWarnings()));
}
Also used : FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Issue(org.jvnet.hudson.test.Issue) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins)

Example 3 with FreeStyleJob

use of org.jenkinsci.test.acceptance.po.FreeStyleJob in project acceptance-test-harness by jenkinsci.

the class AbstractAnalysisTest method should_show_warning_totals_in_view_column_with_link_to_results.

/**
 * Sets up a list view with a warnings column. Builds a job and checks if the column shows the correct number of
 * warnings and provides a direct link to the actual warning results.
 */
@Test
@Issue("JENKINS-24436")
public void should_show_warning_totals_in_view_column_with_link_to_results() {
    FreeStyleJob job = createFreeStyleJob();
    buildJobAndWait(job).shouldSucceed();
    P projectAction = createProjectAction(job);
    addListViewColumn(projectAction.getViewColumn(), jenkins);
    verifyColumn(projectAction);
}
Also used : FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) Issue(org.jvnet.hudson.test.Issue) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test)

Example 4 with FreeStyleJob

use of org.jenkinsci.test.acceptance.po.FreeStyleJob in project acceptance-test-harness by jenkinsci.

the class AbstractAnalysisTest method should_show_build_health.

/**
 * Builds a freestyle job with an enabled publisher of the plug-in under test. Sets the thresholds for the trend
 * report so that a health of 0-19% is evaluated for the plug-in under test (shown as tool tip in the Jenkins
 * main view).
 * TODO: Add different health percentages
 */
@Test
@Issue("JENKINS-28360")
public void should_show_build_health() {
    FreeStyleJob job = createFreeStyleJob();
    AnalysisAction projectAction = createProjectAction(job);
    job.editPublisher(projectAction.getFreeStyleSettings(), settings -> {
        settings.setBuildHealthyThreshold(0);
        settings.setBuildUnhealthyThreshold(getNumberOfWarnings());
    });
    buildSuccessfulJob(job);
    jenkins.open();
    List<WebElement> healthElements = all(by.xpath("//div[@class='healthReportDetails']//tr"));
    assertThat(healthElements.size(), is(3));
    String expectedText = String.format("%s: %d %s%s found.", projectAction.getPluginName(), getNumberOfWarnings(), projectAction.getAnnotationName(), plural(getNumberOfWarnings()));
    assertThatHealthReportIs(healthElements.get(1), expectedText, "00to19");
    assertThatHealthReportIs(healthElements.get(2), "Build stability: No recent builds failed.", "80plus");
}
Also used : AnalysisAction(org.jenkinsci.test.acceptance.plugins.analysis_core.AnalysisAction) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) WebElement(org.openqa.selenium.WebElement) Issue(org.jvnet.hudson.test.Issue) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test)

Example 5 with FreeStyleJob

use of org.jenkinsci.test.acceptance.po.FreeStyleJob in project acceptance-test-harness by jenkinsci.

the class AnalysisCollectorPluginTest method addAndConfigureTasksPublisher.

private void addAndConfigureTasksPublisher(final FreeStyleJob job) {
    TasksFreestyleSettings taskScannerSettings = job.addPublisher(TasksFreestyleSettings.class);
    AnalysisConfigurator<TasksFreestyleSettings> configurator = settings -> {
        settings.setHighPriorityTags("PRIO1");
        settings.setNormalPriorityTags("PRIO2,TODO");
        settings.setLowPriorityTags("PRIO3");
    };
    configurator.accept(taskScannerSettings);
}
Also used : DashboardView(org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView) WorkflowMultiBranchJob(org.jenkinsci.test.acceptance.po.WorkflowMultiBranchJob) CoreMatchers(org.hamcrest.CoreMatchers) Arrays(java.util.Arrays) Since(org.jenkinsci.test.acceptance.junit.Since) Issue(org.jvnet.hudson.test.Issue) FindBugsFreestyleSettings(org.jenkinsci.test.acceptance.plugins.findbugs.FindBugsFreestyleSettings) AnalysisAction(org.jenkinsci.test.acceptance.plugins.analysis_core.AnalysisAction) WebElement(org.openqa.selenium.WebElement) WorkflowJob(org.jenkinsci.test.acceptance.po.WorkflowJob) DockerContainerHolder(org.jenkinsci.test.acceptance.docker.DockerContainerHolder) AnalysisGraphConfigurationView(org.jenkinsci.test.acceptance.plugins.analysis_collector.AnalysisGraphConfigurationView) NestedView(org.jenkinsci.test.acceptance.plugins.nested_view.NestedView) Inject(javax.inject.Inject) GitRepo(org.jenkinsci.test.acceptance.plugins.git.GitRepo) Folder(org.jenkinsci.test.acceptance.po.Folder) WarningsPerProjectPortlet(org.jenkinsci.test.acceptance.plugins.analysis_collector.WarningsPerProjectPortlet) Build(org.jenkinsci.test.acceptance.po.Build) AnalysisConfigurator(org.jenkinsci.test.acceptance.plugins.analysis_core.AnalysisConfigurator) Map(java.util.Map) AnalysisPlugin(org.jenkinsci.test.acceptance.plugins.analysis_collector.AnalysisPlugin) ListView(org.jenkinsci.test.acceptance.po.ListView) WithDocker(org.jenkinsci.test.acceptance.junit.WithDocker) AnalysisCollectorColumn(org.jenkinsci.test.acceptance.plugins.analysis_collector.AnalysisCollectorColumn) Description(org.hamcrest.Description) Job(org.jenkinsci.test.acceptance.po.Job) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) WarningsBuildSettings(org.jenkinsci.test.acceptance.plugins.warnings.WarningsBuildSettings) GitBranchSource(org.jenkinsci.test.acceptance.plugins.workflow_multibranch.GitBranchSource) By(org.openqa.selenium.By) Test(org.junit.Test) AnalysisCollectorSettings(org.jenkinsci.test.acceptance.plugins.analysis_collector.AnalysisCollectorSettings) TasksFreestyleSettings(org.jenkinsci.test.acceptance.plugins.tasks.TasksFreestyleSettings) WithCredentials(org.jenkinsci.test.acceptance.junit.WithCredentials) CheckStyleFreestyleSettings(org.jenkinsci.test.acceptance.plugins.checkstyle.CheckStyleFreestyleSettings) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) AnalysisCollectorAction(org.jenkinsci.test.acceptance.plugins.analysis_collector.AnalysisCollectorAction) NoSuchElementException(org.openqa.selenium.NoSuchElementException) List(java.util.List) MatcherAssert(org.hamcrest.MatcherAssert) Matcher(org.jenkinsci.test.acceptance.Matcher) GitContainer(org.jenkinsci.test.acceptance.docker.fixtures.GitContainer) Matchers(org.jenkinsci.test.acceptance.Matchers) Container(org.jenkinsci.test.acceptance.po.Container) Collections(java.util.Collections) PmdFreestyleSettings(org.jenkinsci.test.acceptance.plugins.pmd.PmdFreestyleSettings) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins) TasksFreestyleSettings(org.jenkinsci.test.acceptance.plugins.tasks.TasksFreestyleSettings)

Aggregations

FreeStyleJob (org.jenkinsci.test.acceptance.po.FreeStyleJob)263 Test (org.junit.Test)242 AbstractJUnitTest (org.jenkinsci.test.acceptance.junit.AbstractJUnitTest)170 Build (org.jenkinsci.test.acceptance.po.Build)105 DockerTest (org.jenkinsci.test.acceptance.junit.DockerTest)51 WithPlugins (org.jenkinsci.test.acceptance.junit.WithPlugins)37 Issue (org.jvnet.hudson.test.Issue)32 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)23 JobDslBuildStep (org.jenkinsci.test.acceptance.plugins.job_dsl.JobDslBuildStep)23 SmokeTest (org.jenkinsci.test.acceptance.junit.SmokeTest)21 Resource (org.jenkinsci.test.acceptance.junit.Resource)19 DashboardView (org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView)19 File (java.io.File)17 DockerContainer (org.jenkinsci.test.acceptance.docker.DockerContainer)17 WithCredentials (org.jenkinsci.test.acceptance.junit.WithCredentials)17 PublishGlobalPublisher (org.jenkinsci.test.acceptance.plugins.publish_over.PublishGlobalPublisher)17 SvnContainer (org.jenkinsci.test.acceptance.docker.fixtures.SvnContainer)16 SubversionScm (org.jenkinsci.test.acceptance.plugins.subversion.SubversionScm)13 ListView (org.jenkinsci.test.acceptance.po.ListView)12 Pattern (java.util.regex.Pattern)11