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.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
One step to run, intended to be a SAM for lambdas withthen(org.jvnet.hudson.test.junit.jupiter.JenkinsSessionExtension.Step)
. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
afterEach
(org.junit.jupiter.api.extension.ExtensionContext context) void
beforeEach
(org.junit.jupiter.api.extension.ExtensionContext context) getHome()
Get the Jenkins home directory, which is consistent across restarts.void
Run one Jenkins session and shut down.
-
Constructor Details
-
JenkinsSessionExtension
public JenkinsSessionExtension()
-
-
Method Details
-
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 interfaceorg.junit.jupiter.api.extension.BeforeEachCallback
-
afterEach
public void afterEach(org.junit.jupiter.api.extension.ExtensionContext context) - Specified by:
afterEach
in interfaceorg.junit.jupiter.api.extension.AfterEachCallback
-
then
Run one Jenkins session and shut down.- Throws:
Throwable
-