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

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

by Marc Guillemot :: Rate this Message:

Reply to Author | View in Thread

Hi,

WebtestCase's webtest method first calls the config method before to
execute the closure, therefore something like that would work (ok,
having to explicitly get ant reference is not so beautiful ;-))
what about this

  void config()
  {
     ant.config(browser: 'FF3')
  }

Cheers,
Marc.
--
Web: http://www.efficient-webtesting.com
Blog: http://mguillem.wordpress.com

manuel aldana wrote:

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

_______________________________________________
WebTest mailing list
WebTest@...
http://lists.canoo.com/mailman/listinfo/webtest

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