4 messages in com.canoo.lists.webtestRe: [Webtest] how to change user-agen...| From | Sent On | Attachments |
|---|---|---|
| Sanju Nath | 27 Mar 2006 16:48 | |
| Marc Guillemot | 27 Mar 2006 23:08 | |
| Sanju Nath | 28 Mar 2006 17:01 | |
| Marc Guillemot | 28 Mar 2006 22:51 |
| Subject: | Re: [Webtest] how to change user-agent inside groovy code![]() |
|---|---|
| From: | Marc Guillemot (mgui...@yahoo.fr) |
| Date: | 03/28/2006 10:51:01 PM |
| List: | com.canoo.lists.webtest |
A grails webtest user! Perhaps the first one ;-) Dierk would be happy.
I don't have used grails until now and Dierk is away for 2 weeks.
If your webtests extend grails.util.Webtest, I would try to overload the webtest method. Currently this is:
void webtest(String name, Closure yield){ ant.testSpec(name:name){ config(configMap) steps(){ yield.delegate = ant yield() } } }
when your overload it to
void webtest(String name, Closure yield){ ant.testSpec(name:name){ config(configMap) { header(name: 'User-Agent', value: 'what you want') } steps(){ yield.delegate = ant yield() } } }
you should become the behavior that you want. It would surely make sense to give the possibility natively in grails.util.Webtest to specify headers. As long as it is not the case, I would place it in a base test class that your tests extend (besides this functionality, it makes sense to have a custom base test class - even if empty at the beginning - to group common functionalities you want to have for different tests).
Marc.
PS: I'm a Groovy beginner so I can't give any assurance on the validity of the code above.
--
View this message in context:
http://www.nabble.com/how-to-change-user-agent-inside-groovy-code-t1353015.html#a3644588
Sent from the WebTest forum at Nabble.com.




