Class RestartableJenkinsRule

All Implemented Interfaces:

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).

Kohsuke Kawaguchi
See Also: