FWD: Re: [Webtest] is it possible to include python in Webtest XML
code
Paul King
Paul King <paulk@asert.com.au>
Wed, 17 Jan 2007 06:43:30 +1000
meant to send this to the list ...
Chang Su wrote:
> thaks Paul for your reply.
>
> Could you explain in more detail since I am really new
> to webtest and know nothing about groovy yet.
>
> what is the "hostname" in "hostname".execute().text
> that you suggested?
hostname is a shell/console command you can "exec" in
a unix shell/dos window. execute() is a special groovy
add-on for strings which effectively does something like
python's os.system() or os.execXX() on the string.
On my system:
println "hostname".execute().text.trim() // => LYREBIRD
println InetAddress.localHost // => LYREBIRD/192.168.0.22
You'll of course want to store it in a property to check against.
Cheers, Paul.