Forum Discussion

slipperysucker's avatar
slipperysucker
New Contributor
12 years ago

writting output to Soapui screen

Dear all,

I am new to SOAPUI & GROOVY Script, in fact I just picked up the book(groovy in action) recently. I would like to learn groovy scripting in conjunction with SOAPUI(4.0.1). I have gone through the intro chapter with “Hello world”. I have type the example code from the book directly into my SOAPUI script step, most of the script seem to work. However when I try the Fibonacci number example code;

current = 1
next = 1
10.times {
print current + ' '
newCurrent = next
next = next + current
current = newCurrent
}
println ''

I can’t see any response (result) on my SoapUI screen. While the same set of code running on groovy console does works(ie, show the number sequence).

The problems seem to be;

the (println '') which is understood by Groovy console but not SOAPUI. This command seem to print the information onto the screen in the groovy console, but in soapui there may not be a console. Checking with google got me the answer of “writer.writer (xxxxx)”statement, but upon running the script. I get only error messages.

Def current = 1
Def next = 1
Def a = 0
//10.times//
While (a <= 10){
print current + ' '
newCurrent = next
next = next + current
current = newCurrent
a++
}
//println ''//
//Writer.writer(current)
//Write.close()


The Question is.
is there a SOAPUI equivalents to the “println” groovy command? Which will allow me to print the output in the soapui screen somewhere.

Thank you for all your time and effort.
Sincerely.

1 Reply

  • tjdurden's avatar
    tjdurden
    Frequent Contributor
    Hi slipperysucker,

    You can write to the Log Output window in Groovy using the following:


    log.info ("Some Info!");
    log.warn ("Some Warning!!");
    log.error ("Some Error!!!");

    Kind regards,
    Tim