Search in sources :

Example 1 with Mailer

use of org.jenkinsci.test.acceptance.plugins.mailer.Mailer in project acceptance-test-harness by jenkinsci.

the class MailerPluginTest method send_mail_for_failed_build.

@Test
public void send_mail_for_failed_build() throws IOException {
    FreeStyleJob job = jenkins.jobs.create();
    job.configure();
    job.addShellStep("fail");
    Mailer m = job.addPublisher(Mailer.class);
    m.recipients.set("dev@example.com mngmnt@example.com");
    job.save();
    job.startBuild().shouldFail();
    mailhog.assertMail(Pattern.compile("Build failed in Jenkins: .* #1"), "dev@example.com mngmnt@example.com", Pattern.compile("failure"));
}
Also used : Mailer(org.jenkinsci.test.acceptance.plugins.mailer.Mailer) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) DockerTest(org.jenkinsci.test.acceptance.junit.DockerTest)

Example 2 with Mailer

use of org.jenkinsci.test.acceptance.plugins.mailer.Mailer in project acceptance-test-harness by jenkinsci.

the class MavenPluginTest method send_mail.

@Test
@Issue({ "JENKINS-20209", "JENKINS-21045" })
public void send_mail() throws Exception {
    installSomeMaven(jenkins);
    MailhogContainer mailhog = mailhogProvider.get();
    MavenModuleSet job = jenkins.jobs.create(MavenModuleSet.class);
    job.configure();
    Mailer mailer = job.addBuildSettings(Mailer.class);
    mailer.recipients.set("root@example.com");
    job.save();
    job.startBuild().shouldFail();
    mailhog.assertMail(Pattern.compile("Build failed in Jenkins: .* #1"), "root@example.com", Pattern.compile(job.name));
}
Also used : Mailer(org.jenkinsci.test.acceptance.plugins.mailer.Mailer) MailhogContainer(org.jenkinsci.test.acceptance.docker.fixtures.MailhogContainer) MavenModuleSet(org.jenkinsci.test.acceptance.plugins.maven.MavenModuleSet) Issue(org.jvnet.hudson.test.Issue) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) DockerTest(org.jenkinsci.test.acceptance.junit.DockerTest)

Aggregations

AbstractJUnitTest (org.jenkinsci.test.acceptance.junit.AbstractJUnitTest)2 DockerTest (org.jenkinsci.test.acceptance.junit.DockerTest)2 Mailer (org.jenkinsci.test.acceptance.plugins.mailer.Mailer)2 Test (org.junit.Test)2 MailhogContainer (org.jenkinsci.test.acceptance.docker.fixtures.MailhogContainer)1 MavenModuleSet (org.jenkinsci.test.acceptance.plugins.maven.MavenModuleSet)1 FreeStyleJob (org.jenkinsci.test.acceptance.po.FreeStyleJob)1 Issue (org.jvnet.hudson.test.Issue)1