Search in sources :

Example 11 with GradleStep

use of org.jenkinsci.test.acceptance.plugins.gradle.GradleStep in project acceptance-test-harness by jenkinsci.

the class GradlePluginTest method run_gradle_script_in_dir.

/**
 * Verify the execution of gradle build script localized divergent to default folder.
 */
@Test
public void run_gradle_script_in_dir() {
    final String gradleInstallationName = "gradle-1.5";
    GradleInstallation.installGradle(jenkins, gradleInstallationName, "1.5");
    FreeStyleJob job = jenkins.jobs.create();
    job.copyResource(resource(GRADLE_SCRIPT_NO_PLUGIN), "gradle/hello.gradle");
    GradleStep step = job.addBuildStep(GradleStep.class);
    step.setFile("hello.gradle");
    step.setVersion(gradleInstallationName);
    step.setTasks(HELLO.getName());
    step.setDir("gradle");
    job.save();
    final Build build = job.startBuild();
    build.shouldSucceed();
    assertThat(build.getConsole(), containsString(HELLO.getPrintln()));
}
Also used : GradleStep(org.jenkinsci.test.acceptance.plugins.gradle.GradleStep) Matchers.containsString(org.jenkinsci.test.acceptance.Matchers.containsString) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test)

Example 12 with GradleStep

use of org.jenkinsci.test.acceptance.plugins.gradle.GradleStep in project acceptance-test-harness by jenkinsci.

the class GradlePluginTest method run_gradle_environment_variables.

/**
 * Verify the execution of gradle build script with Jenkins environment variables as gradle parameters.
 */
@Test
public void run_gradle_environment_variables() {
    GradleInstallation.installGradle(jenkins);
    final FreeStyleJob job = jenkins.jobs.create();
    job.copyResource(resource(GRADLE_SCRIPT), "build.gradle");
    final GradleStep step = job.addBuildStep(GradleStep.class);
    step.setVersion(GradleInstallation.DEFAULT);
    step.setTasks(ENVIRONMENT_VARIABLES.getName());
    job.save();
    final Build build = job.startBuild().shouldSucceed();
    assertThat(build.getConsole(), containsString("Build Number: " + build.getNumber()));
    assertThat(build.getConsole(), containsString("Build Name: " + build.getName()));
}
Also used : GradleStep(org.jenkinsci.test.acceptance.plugins.gradle.GradleStep) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test)

Aggregations

AbstractJUnitTest (org.jenkinsci.test.acceptance.junit.AbstractJUnitTest)12 GradleStep (org.jenkinsci.test.acceptance.plugins.gradle.GradleStep)12 Test (org.junit.Test)12 WebElement (org.openqa.selenium.WebElement)2 Matchers.containsString (org.hamcrest.Matchers.containsString)1 Matchers.containsString (org.jenkinsci.test.acceptance.Matchers.containsString)1 ArtifactoryContainer (org.jenkinsci.test.acceptance.docker.fixtures.ArtifactoryContainer)1 DockerTest (org.jenkinsci.test.acceptance.junit.DockerTest)1 WithPlugins (org.jenkinsci.test.acceptance.junit.WithPlugins)1 ArtifactoryGradleConfiguratior (org.jenkinsci.test.acceptance.plugins.artifactory.ArtifactoryGradleConfiguratior)1 Build (org.jenkinsci.test.acceptance.po.Build)1 FreeStyleJob (org.jenkinsci.test.acceptance.po.FreeStyleJob)1 Ignore (org.junit.Ignore)1 Issue (org.jvnet.hudson.test.Issue)1