Hi there,

I'm attempting to create an automation suite using webtest, and written
expressly in groovy.  I'm fairly new with this and I'm running into an issue
separating out the config() call into a separate class.  What I'd like to do
is create a single callable method which can be shared across all my test
methods.

When using Webtest as XML, I did this by using different defined configs
through the use of <!ENTITY...>.  This is necessary for me because I might
have to make an API call in conjunction with webflows.

Within a single test, i can add this and things work great:

    def config_map = new HttpConfig().getConfigMap()

    void config(){
        ant.config(config_map){
            option(name:"ThrowExceptionOnScriptError", value:"false")
            option(name:"ThrowExceptionOnFailingStatusCode", value:"false")
            option(name:"JavaScriptEnabled", value:"true")
            header(name:"Accept-Language", value:"en-us,en;q=0.5")
            header(name:"Accept-Charset",
value:"ISO-8859-1,utf-8;q=0.7,*;q=0.7")
        }
    }

However I want to pull config() out of the test method so that I would only
need to make a call like this:

    new HttpConfig().setConfig();

Where setConfig() includes the config() method.  Has any one accomplished
this?  I'm still coming up to speed here and I feel like I've hit a brick
wall.

Thanks,
-erin

Reply via email to