use of org.jenkinsci.test.acceptance.plugins.gradle.GradleStep in project acceptance-test-harness by jenkinsci.
the class GradlePluginTest method run_gradle_user_home_workspace.
/**
* Verify the execution of gradle build script with gradle installation files in the job workspace.
*/
@Test
public void run_gradle_user_home_workspace() {
GradleInstallation.installGradle(jenkins);
final FreeStyleJob job = jenkins.jobs.create();
job.copyResource(resource(GRADLE_SCRIPT), "build.gradle");
final GradleStep step = job.addBuildStep(GradleStep.class);
step.setTasks(HELLO.getName());
step.setVersion(GradleInstallation.DEFAULT);
step.setForceGradleHomeToUseWorkspace();
job.save();
job.startBuild().shouldSucceed();
assertThat(job, Workspace.workspaceContains("caches"));
}
use of org.jenkinsci.test.acceptance.plugins.gradle.GradleStep in project acceptance-test-harness by jenkinsci.
the class GradlePluginTest method run_gradle_add_system_properties.
/**
* Verify the execution of gradle build script with committed gradle system properties.
*/
@Test
public void run_gradle_add_system_properties() {
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.setSystemProperties("TEST_PARAM_1=hello\nTEST_PARAM_2=world");
step.setTasks(JOB_PARAM_AS_SYSTEM_PROPERTIES.getName());
job.save();
final Build build = job.startBuild().shouldSucceed();
assertThat(build.getConsole(), containsString("Gradle Properties: hello world"));
}
use of org.jenkinsci.test.acceptance.plugins.gradle.GradleStep in project acceptance-test-harness by jenkinsci.
the class GradlePluginTest method run_gradle_job_parameters_as_system_properties.
/**
* Verify the execution of gradle build script with committed parameters as gradle system properties.
*/
@Test
public void run_gradle_job_parameters_as_system_properties() {
GradleInstallation.installGradle(jenkins);
final FreeStyleJob job = jenkins.jobs.create();
job.copyResource(resource(GRADLE_SCRIPT), "build.gradle");
job.addParameter(StringParameter.class).setName("TEST_PARAM_1").setDefault("hello");
job.addParameter(StringParameter.class).setName("TEST_PARAM_2").setDefault("world");
final GradleStep step = job.addBuildStep(GradleStep.class);
step.setVersion(GradleInstallation.DEFAULT);
step.setTasks(JOB_PARAM_AS_SYSTEM_PROPERTIES.getName());
step.setPassAllAsSystemProperties();
job.save();
final Build build = job.startBuild().shouldSucceed();
assertThat(build.getConsole(), containsString("Gradle Properties: hello world"));
}
use of org.jenkinsci.test.acceptance.plugins.gradle.GradleStep in project acceptance-test-harness by jenkinsci.
the class GradlePluginTest method run_gradle_script_build_scan_link.
/**
* Verify the execution of gradle build and check if build scan links are available
*/
@Test
public void run_gradle_script_build_scan_link() {
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(HELLO.getName());
step.setSwitches("--scan");
job.save();
final Build build = job.startBuild();
build.shouldSucceed();
build.openStatusPage();
final WebElement buildScanLink = build.find(By.partialLinkText("Gradle Build Scan"));
assertThat(buildScanLink.getAttribute("href"), containsString("https://gradle.com/"));
}
use of org.jenkinsci.test.acceptance.plugins.gradle.GradleStep in project acceptance-test-harness by jenkinsci.
the class GradlePluginTest method run_gradle_tasks_link.
/**
* Verify the existence of links for executed tasks.
*/
@Test
public void run_gradle_tasks_link() {
GradleInstallation.installGradle(jenkins);
final FreeStyleJob job = jenkins.jobs.create();
job.copyResource(resource(GRADLE_SCRIPT), "build.gradle");
final GradleStep step = job.addBuildStep(GradleStep.class);
step.setTasks(FIRST.getName() + " " + SECOND.getName());
step.setVersion(GradleInstallation.DEFAULT);
job.save();
final Build build = job.startBuild().shouldSucceed();
final WebElement firstTaskLink = build.find(By.partialLinkText(FIRST.getName()));
final WebElement secondTaskLink = build.find(By.partialLinkText(SECOND.getName()));
assertThat(firstTaskLink.getAttribute("href"), containsString("#gradle-task-0"));
assertThat(secondTaskLink.getAttribute("href"), containsString("#gradle-task-1"));
assertThat(build.getConsole(), containsString(FIRST.getPrintln()));
assertThat(build.getConsole(), containsString(SECOND.getPrintln()));
}
Aggregations