use of org.jenkinsci.test.acceptance.po.FreeStyleJob in project acceptance-test-harness by jenkinsci.
the class MissionControlTest method testBuildHistory.
/**
* Test Case: Check the existence and size of the build history, as well as
* the correct highlighting of the builds.
*/
@Test
public void testBuildHistory() {
// Create new mission control view and configure it
int historySize = 8;
MissionControlView view = jenkins.views.create(MissionControlView.class, "mission-control-sample-view");
view.configure();
view.setHideBuildHistory(false);
view.setHistorySize(historySize);
view.save();
String strSimpleJob = "simple-job";
String strFailedJob = "simple-failed-job";
// Create new freestyle job and build it n-times
FreeStyleJob job = jenkins.jobs.create(FreeStyleJob.class, strSimpleJob);
for (int i = 0; i < historySize; ++i) {
job.startBuild().waitUntilFinished();
}
job = jenkins.jobs.create(FreeStyleJob.class, strFailedJob);
job.configure();
// Add invalid shell build step to cause the job to fail
job.addShellStep("sh <");
job.save();
job.startBuild().waitUntilFinished();
// Open mission control view and assert that no build entries are being displayed
// (after the creation of a new mission control view the configuration needs to be reloaded)
view.open();
assertThat(view.getBuildHistoryArea().getBuildHistorySize(), is(0));
// Reload configuration (alternative: jenkins.restart(), very inefficient for this task)
view.reloadConfiguration();
// Open mission control view again and assert that the n-builds are being displayed now
view.open();
assertThat(view.getBuildHistoryArea().getBuildHistorySize(), is(historySize));
// Check for correct highlighting of the builds
// Also, according to the made settings, there should be 1 failed and historySize - 1 successful builds
// in the build history
assertThat(view.getBuildHistoryArea().getFailedBuildsOfJob(strFailedJob), hasSize(1));
assertThat(view.getBuildHistoryArea().getSuccessfulBuildsOfJob(strSimpleJob), hasSize(historySize - 1));
}
use of org.jenkinsci.test.acceptance.po.FreeStyleJob in project acceptance-test-harness by jenkinsci.
the class MultipleScmsPluginTest method checkout_several_scms.
@Test
public void checkout_several_scms() {
FreeStyleJob job = jenkins.jobs.create();
job.configure();
MultipleScms scms = job.useScm(MultipleScms.class);
GitScm git = scms.addScm(GitScm.class);
git.url("git://github.com/jenkinsci/acceptance-test-harness.git");
git.localDir("git-project");
SubversionScm svn = scms.addScm(SubversionScm.class);
svn.url.set("http://svn.apache.org/repos/asf/subversion/trunk/build/");
svn.local.set("svn-project");
job.addShellStep("test -d svn-project/.svn && test -f git-project/pom.xml");
job.save();
job.startBuild().shouldSucceed();
}
use of org.jenkinsci.test.acceptance.po.FreeStyleJob in project acceptance-test-harness by jenkinsci.
the class DashboardViewPluginTest method latestsBuildsPortlet_correctJobLink.
@Test
public void latestsBuildsPortlet_correctJobLink() {
DashboardView v = createDashboardView();
LatestBuildsPortlet latestBuilds = v.addBottomPortlet(LatestBuildsPortlet.class);
v.save();
FreeStyleJob job = createFreeStyleJob();
buildSuccessfulJob(job);
v.open();
latestBuilds.openJob(job.name);
assertThat(driver, hasContent("Project " + job.name));
}
use of org.jenkinsci.test.acceptance.po.FreeStyleJob in project acceptance-test-harness by jenkinsci.
the class FindBugsPluginTest method should_link_to_source_code_in_real_project.
/**
* Builds a freestyle project and checks if new warning are displayed.
*/
@Test
public void should_link_to_source_code_in_real_project() {
FreeStyleJob job = createJob(jenkins, "/findbugs_plugin/sample_findbugs_project", FreeStyleJob.class, FindBugsFreestyleSettings.class, settings -> settings.pattern.set("target/findbugsXml.xml"));
setMavenGoal(job, "clean package findbugs:findbugs");
Build build = buildSuccessfulJob(job);
assertThatFindBugsResultExists(job, build);
build.open();
FindBugsAction action = new FindBugsAction(build);
action.open();
assertThat(action.getNumberOfNewWarnings(), is(1));
verifySourceLine(action, "Main.java", 18, "18 if(o == null) {", "Redundant nullcheck of o, which is known to be non-null in Main.main(String[])");
}
use of org.jenkinsci.test.acceptance.po.FreeStyleJob in project acceptance-test-harness by jenkinsci.
the class FindBugsPluginTest method should_report_new_and_fixed_warnings_in_consecutive_builds.
/**
* Runs job two times to check if new and fixed warnings are displayed. Afterwards, the first build
* is deleted and Jenkins is restarted. Then the results of the second build are validated again: the detail
* pages should then show the same results (see JENKINS-24940).
*/
@Test
@Issue("24940")
public void should_report_new_and_fixed_warnings_in_consecutive_builds() {
assumeTrue("This test requires a restartable Jenkins", jenkins.canRestart());
FreeStyleJob job = createFreeStyleJob();
Build firstBuild = buildJobAndWait(job);
editJob("/findbugs_plugin/forSecondRun/findbugsXml.xml", false, job, FindBugsFreestyleSettings.class);
Build lastBuild = buildSuccessfulJob(job);
assertThatFindBugsResultExists(job, lastBuild);
lastBuild.open();
verifyWarningCounts(lastBuild);
firstBuild.delete();
jenkins.restart();
lastBuild.open();
verifyWarningCounts(lastBuild);
}
Aggregations