Class RestartableJenkinsRule

java.lang.Object
org.jvnet.hudson.test.RestartableJenkinsRule
All Implemented Interfaces:
org.junit.rules.MethodRule

public class RestartableJenkinsRule extends Object implements org.junit.rules.MethodRule
Provides a pattern for executing a sequence of steps. In between steps, Jenkins gets restarted.

To use this, add this rule instead of JenkinsRule to the test, then from your test method, call then(org.jvnet.hudson.test.RestartableJenkinsRule.Step) repeatedly. You may test scenarios related to abrupt shutdowns or failures to start using thenWithHardShutdown(org.jvnet.hudson.test.RestartableJenkinsRule.Step) and thenDoesNotStart().

The rule will evaluate your test method to collect all steps, then execute them in turn and restart Jenkins in between each step. Consider using JenkinsSessionRule if you want each step to be executed immediately when then(org.jvnet.hudson.test.RestartableJenkinsRule.Step) is called.

If your test requires disabling of a plugin then the default PluginManager (TestPluginManager) used for tests will need to be changed to UnitTestSupportingPluginManager. This can be accomplished by annotating the test with @WithPluginManager(UnitTestSupportingPluginManager.class).

Since:
1.567
Author:
Kohsuke Kawaguchi
See Also: