« Return to Thread: groovy: best way to put config() settings to setUp()

Re: groovy: best way to put config() settings to setUp()

by aldana :: Rate this Message:

Reply to Author | View in Thread

manuel aldana wrote:

> hi,
>
> throughout my test methods the config settings are repeating and I
> would like to put it to the setUp() method (see sample code). put then
> the inner webtest closure context is lost and the config setting won't
> work.
>
> --------------------------------------
> void setUp(){
>  config(....){...}
> }
>
> void test1(){
>  webtest(...){....}
> }
>
> void test2(){
>  webtest(...){....}
> }
> -----------------------------------
>
> how is it possible to extract the config-settings inside a setup
> logic? Looking at the code itself I think it is not possible because
> the webtest() context is unknown inside setUp().
>
>
I found a little workaround, which is still forcing a config setting in
each test method, but at least duplicates less stuff.

-----------------------------------
def config={webtestContext ->
  webtestContext.config(...){...}
}

void test1(){
  webtest(...){config(delegate);....}
}

void test2(){
  webtest(...){config(delegate);....}
}
-----------------------------------


--
 manuel aldana
 aldana@...
 software-engineering blog: http://www.aldana-online.de 

_______________________________________________
WebTest mailing list
WebTest@...
http://lists.canoo.com/mailman/listinfo/webtest
manuel aldana
aldana((at))gmx.de
software-engineering blog: http://www.aldana-online.de

 « Return to Thread: groovy: best way to put config() settings to setUp()