Class JenkinsSessionExtension

java.lang.Object
org.jvnet.hudson.test.junit.jupiter.JenkinsSessionExtension
All Implemented Interfaces:
org.junit.jupiter.api.extension.AfterEachCallback, org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.Extension

public class JenkinsSessionExtension extends Object implements org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.AfterEachCallback
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.
  • Constructor Details

    • JenkinsSessionExtension

      public JenkinsSessionExtension()
  • Method Details

    • getHome

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

      public void beforeEach(org.junit.jupiter.api.extension.ExtensionContext context)
      Specified by:
      beforeEach in interface org.junit.jupiter.api.extension.BeforeEachCallback
    • afterEach

      public void afterEach(org.junit.jupiter.api.extension.ExtensionContext context)
      Specified by:
      afterEach in interface org.junit.jupiter.api.extension.AfterEachCallback
    • then

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