Reputation: 3946
If we write a
log.info "Running Test Case"
This will come under Log Output when you run as a test Step
When you run at test case level, it will go under Script Log
But when you run the same statement from script assertion, it will be shown there, but not under script log
So i would like to see the logging done from Script Assertion to appear under Script Log
I have attached the way by which we can print the log.info under Ready API Log.
Upvotes: 1
Views: 8636
Reputation: 727
It should be going to the ReadyAPI log when you actually run the test case.
When you run your script in the Script Assertion Editor, the "log" variable is a Logger that appends to that window. When your assertion runs normally as part of a test case, log will be a logger that writes to the Script Log.
If you really want to write to the Script log while testing your assertion in the Script Assertion editor, you can use:
import org.apache.log4j.Logger
Logger scriptLog = Logger.getLogger("groovy.log")
scriptLog.info "Hello World"
Or of course, just reassign the existing log variable:
import org.apache.log4j.Logger
log = Logger.getLogger("groovy.log")
log.info "Hello World"
Disclaimer: I found the name of the logger ("groovy.log"
) by running log.info log.name
and running the test case. I did this on the Open Source version of SoapUI. It's possible that the logger name is different in ReadyAPI.
Upvotes: 3