Class GroovyJenkinsRule

  • All Implemented Interfaces:
    hudson.ExtensionPoint, hudson.model.Action, hudson.model.ModelObject, hudson.model.RootAction, org.junit.rules.MethodRule, org.junit.rules.TestRule

    public class GroovyJenkinsRule
    extends JenkinsRule
    JenkinsRule variant with special options for tests written in Groovy.
    • Constructor Detail

      • GroovyJenkinsRule

        public GroovyJenkinsRule()
    • Method Detail

      • executeOnServer

        public Object executeOnServer​(groovy.lang.Closure<?> c)
                               throws Exception
        Executes the given closure on the server, in the context of an HTTP request. This is useful for testing some methods that require StaplerRequest and StaplerResponse.

        The closure will get the request and response as parameters.

      • builder

        public hudson.tasks.Builder builder​(groovy.lang.Closure<?> c)
        Wraps a closure as a Builder.