use of org.jenkinsci.test.acceptance.po.Job in project acceptance-test-harness by jenkinsci.
the class JobDslPluginTest method should_create_just_one_job_if_two_with_same_name_are_declared.
/**
* Tests whether a job exists once when two jobs with the same name are created
* by JobDsl and the seed job is build.
*/
@Test
public void should_create_just_one_job_if_two_with_same_name_are_declared() {
// Arrange
String jobName = "MyJob";
String jobDslScript = String.format("job('%s'); job('%s')", jobName, jobName);
Job seed = createSeedJobWithJobDsl(jobDslScript);
// Act
seed.startBuild().waitUntilFinished();
// Assert
Job job = jenkins.jobs.get(Job.class, jobName);
assertThat(job, pageObjectExists());
}
use of org.jenkinsci.test.acceptance.po.Job in project acceptance-test-harness by jenkinsci.
the class JobDslPluginTest method should_run_two_concurrent_builds.
/**
* Tests whether two builds are in progress at the same time of a new job with
* concurrent build attribute created by JobDsl when the seed job is build and two
* builds are triggered.
*/
@Test
public void should_run_two_concurrent_builds() {
// Arrange
String jobName = "MyJob";
String jobDslScript = String.format("job('%s') { concurrentBuild(); steps { shell('sleep 10') } }", jobName);
Job seed = createSeedJobWithJobDsl(jobDslScript);
// Act
seed.startBuild().waitUntilFinished();
Job job = jenkins.jobs.get(Job.class, jobName);
Build firstBuild = job.scheduleBuild().waitUntilStarted();
Build secondBuild = job.scheduleBuild().waitUntilStarted();
// Assert
assertTrue(firstBuild.isInProgress());
assertTrue(secondBuild.isInProgress());
firstBuild.stop();
secondBuild.stop();
}
use of org.jenkinsci.test.acceptance.po.Job in project acceptance-test-harness by jenkinsci.
the class JobDslPluginTest method job_filters_status_failed_exclude_matched.
/**
* This test creates a job and runs a build which fails. Afterwards 4 new jobs get created as well as a listView.
* The job filter of the listView is set to not show jobs which build status is 'FAILED'.
*/
@Test
@WithPlugins("view-job-filters")
public void job_filters_status_failed_exclude_matched() {
Job failedJob = createJobThatFails();
List<Job> jobs = createAmountOfJobs(4, true);
String jobDslScript = "listView('" + LIST_VIEW_NAME + "') {\n" + " columns {\n" + " name()\n" + " }\n" + " jobs{\n" + " names('" + failedJob.name + "','" + jobs.get(0).name + "','" + jobs.get(1).name + "','" + jobs.get(2).name + "','" + jobs.get(3).name + "')\n" + " }\n" + " jobFilters {\n" + " status {\n" + " matchType(MatchType.EXCLUDE_MATCHED)\n" + " status(Status.FAILED)\n" + " }\n" + " }\n" + "}";
View view = openNewlyCreatedListView(jobDslScript, LIST_VIEW_NAME);
assertThat(view, not(containsJob(failedJob)));
assertThat(view, containsJob(jobs.get(0)));
assertThat(view, containsJob(jobs.get(1)));
assertThat(view, containsJob(jobs.get(2)));
assertThat(view, containsJob(jobs.get(3)));
}
use of org.jenkinsci.test.acceptance.po.Job in project acceptance-test-harness by jenkinsci.
the class JobDslPluginTest method should_create_new_job.
/**
* Tests whether a new job is created by JobDsl when the seed job is build.
*/
@Test
public void should_create_new_job() {
// Arrange
String jobName = "MyJob";
String jobDslScript = String.format("job('%s')", jobName);
Job seed = createSeedJobWithJobDsl(jobDslScript);
// Act
seed.startBuild().waitUntilFinished();
// Assert
Job job = jenkins.jobs.get(Job.class, jobName);
assertThat(job, pageObjectExists());
}
use of org.jenkinsci.test.acceptance.po.Job in project acceptance-test-harness by jenkinsci.
the class GitPluginNoDockerTest method generateJobWithLocalBranch.
private Job generateJobWithLocalBranch(GIT_IMPL type) {
Job job = generateJob(type);
GitScm scm = generateSCM(job).localBranch("selenium_test_branch");
useJGitIfNeccesary(type, scm);
return job;
}
Aggregations