问题
I need to create a log file from a SOAPUI load test that shows the threadcount at 1-second intervals. The file needs only a timestamp and the threadcount, and can be CSV or any other format really. I can't see a way to get just this info from the predefined log files.
Is a Groovy script step the right way to do this? How would I write it? I could have a test case that does nothing but writes the log message every second while the "real" cases are running concurrently, but I don't know how to write that simple bit of script. I find the documentation almost impenetrable.
Thanks in advance!
回答1:
This runs faster than once per second. If it works for you I can explain how to cut the time down:
if (context.LoadTestContext != null)
{
log.info("threads = " + testRunner.getRunContext().LoadTestRunner.getRunningThreadCount() )
}
(It is a Groovy script)
By the way, load test script logging is off by default in SoapUI. You need to go to Preferences, UI Settings & check the "Do not disable the groovy log when running load tests" checkbox.
来源:https://stackoverflow.com/questions/10543071/how-can-i-log-the-current-threadcount-in-soapui