Command Line Run with output files that contain "Messages" that I would like to control
Hello,
I am running lots of tests through the ReadyAPI/SoapUI command line. There is parameter to generate reports (not really important just background for the question)...
CALL "C:\Program Files\SmartBear\%readyapiversion%\bin\testrunner.bat" -r -a -j -f%fParm% "-RJUnit-Style HTML Report" -E"%EParm%" -s"%suite%" -c"%testcase%" %project% > %fParm%\RunLog.txt
Some of the "reports" are output text files for each step of a testcase. Each text file contains a section called "----------------- Messages ------------------------------".
It seems the only time this section contains data is on a failure or part of an api invoke with request and response in addition to the messages section. ReadyAPI/SoapUI is in control of the content, not me.
Sample file name content: testcase_teststep_From_JDBC_Data-0-PASS.txt :
Status: PASS
Time Taken: 783
Size: 0
Timestamp: Thu Sep 29 13:19:25 PDT 2022
TestStep: testcase teststep From JDBC Data
----------------- Messages ------------------------------
My question is... How to get data into this "Messages" area myself (i.e. via groovy script or something)?
This question was asked a few years ago:
but there was no solution to it.
Thank you.
Regards,
Todd
Hello KarelHusa
Thank you for the direction. After more research, it looks like the key to that message section is in the "Events" manager portion of ReadyAPI. If I add a new event handler for "TestRunListener.afterStep", I can put whatever I need to in the messages area of the report.
Here is just the smallest code snippet to add to that event...
import com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep import com.eviware.soapui.impl.wsdl.teststeps.RestTestRequestStep import com.eviware.soapui.impl.wsdl.teststeps.HttpTestRequestStep import static com.eviware.soapui.model.testsuite.TestStepResult.TestStepStatus.* def testStep = testStepResult.getTestStep(); testStepResult.addMessage(" --- TESTING"); testStepResult.addMessage(" -- ${testStep.name}");
When run from testrunner.bat, I see the following below for one of my test steps (this code does not differentiate well however, I will adjust it so the message only occurs when I want it to and not for every test step).
Status: PASS Time Taken: 25 Size: 0 Timestamp: Tue Oct 04 19:29:24 PDT 2022 TestStep: Populate Properties For Testcase ----------------- Messages ------------------------------ --- TESTING -- Populate Properties For Testcase
Regards,
Todd