Class JenkinsSessionFixture

java.lang.Object
org.jvnet.hudson.test.fixtures.JenkinsSessionFixture

public class JenkinsSessionFixture extends Object
JenkinsRule derivative which allows Jenkins to be restarted in the middle of a test. It also supports running test code before, between, or after Jenkins sessions, whereas a test method using JenkinsRule directly will only run after Jenkins has started and must complete before Jenkins terminates. Usage:

 private static final JenkinsSessionFixture FIXTURE = new JenkinsSessionFixture();

 public void method() {
     try {
         FIXTURE.setUp([…]);
         FIXTURE.then(() -> […]);
     } finally {
         FIXTURE.tearDown();
     }
 }
 
See Also:
  • Constructor Details

    • JenkinsSessionFixture

      public JenkinsSessionFixture()
  • Method Details

    • getHome

      public File getHome()
      Get the Jenkins home directory, which is consistent across restarts.
    • setUp

      public void setUp(String className, String name, Annotation... annotations)
    • tearDown

      public void tearDown()
    • then

      public void then(JenkinsSessionFixture.Step s) throws Throwable
      Run one Jenkins session and shut down.
      Throws:
      Throwable