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.
    Since:
    1.535
    • 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.

        Throws:
        Exception
      • builder

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