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.
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest