Forum Discussion
Can't the existing files be used instead? Would you mind to tell the use case?
- jkrier9 years agoRegular Contributor
Hi Rao,
Thank you for responding.
I'm not sure if I understand exactly what you mean when you say "existing file". If you mean can the file that is created at the time the testcase is ran than yes. That is what I want to do, export the Script log to another directory.
As for a use case I have a SoapUI project that has multiple testcases. For each one I would like to be able to export the Script log to the project path with a file name like testcasename.log and I think it would be OK for it to be overwritten each time but it might be nice to turn that on and off also, if that is possible.
I have found a few solutions that are similar to this
/The below groovy script step is to capture the soapUI log area. // "soapUI log" can be replaced with http log, jetty log, script log, error log etc based on the need. def logArea = com.eviware.soapui.SoapUI.logMonitor.getLogArea( "soapUI log" ); //Below two lines of groovy script is to get the project directory, we will be saving the soapUI log contents on a file in that directory. def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context) def projectPath = groovyUtils.projectPath def logFile = new File(projectPath + "\\soapUI-Logs-to-file.txt") //This is the first line in the soapUI log file. logFile.write("soapUI Logs In a file.\r\n") if( logArea !=null ) { def model = logArea.model if( model.size > 0 ) for( c in 0..(model.size-1) ) logFile.append(model.getElementAt( c )) }
None of them seem to really work. I can see a file created but it's blank. From looking at this script I think if it worked it would accomplish what I need but not entirely sure since it's not working for me.
- jkrier9 years agoRegular Contributor
If it helps at all this is how I have things being logged to the Script log
Thu Sep 29 16:30:10 MDT 2016:INFO:RUNNING STEP: [DataSource] Thu Sep 29 16:30:10 MDT 2016:INFO:RUNNING STEP: [DataGen] Thu Sep 29 16:30:10 MDT 2016:INFO:RUNNING STEP: [querySERVICE_ACCOUNT_REF_MAP] Thu Sep 29 16:30:15 MDT 2016:INFO:querySERVICE_ACCOUNT_REF_MAP With Assertion "JDBC Status" Has Status VALID Thu Sep 29 16:30:15 MDT 2016:INFO:RUNNING STEP: [POST/serviceLocations] Thu Sep 29 16:30:16 MDT 2016:INFO:POST/serviceLocations With Assertion "Valid HTTP Status Codes" Has Status VALID Thu Sep 29 16:30:16 MDT 2016:INFO:RUNNING STEP: [queryServiceLocationById] Thu Sep 29 16:30:16 MDT 2016:INFO:queryServiceLocationById With Assertion "JDBC Status" Has Status VALID Thu Sep 29 16:30:16 MDT 2016:INFO:queryServiceLocationById With Assertion "Match content of [SERVICE_LOCATION_ID]" Has Status VALID Thu Sep 29 16:30:16 MDT 2016:INFO:queryServiceLocationById With Assertion "Match content of [SERVICE_AGREEMENT_ID]" Has Status VALID Thu Sep 29 16:30:16 MDT 2016:INFO:queryServiceLocationById With Assertion "Match content of [ADDRESS_LINE_1]" Has Status VALID Thu Sep 29 16:30:16 MDT 2016:INFO:queryServiceLocationById With Assertion "Match content of [ADDRESS_LINE_2]" Has Status VALID Thu Sep 29 16:30:16 MDT 2016:INFO:queryServiceLocationById With Assertion "Match content of [MUNICIPALITY]" Has Status VALID Thu Sep 29 16:30:16 MDT 2016:INFO:queryServiceLocationById With Assertion "Match content of [REGION]" Has Status VALID Thu Sep 29 16:30:16 MDT 2016:INFO:queryServiceLocationById With Assertion "Match content of [POSTAL_CODE]" Has Status VALID Thu Sep 29 16:30:16 MDT 2016:INFO:queryServiceLocationById With Assertion "Match content of [COUNTRY_CODE]" Has Status VALID Thu Sep 29 16:30:16 MDT 2016:INFO:queryServiceLocationById With Assertion "Match content of [REQUESTED_LATITUDE]" Has Status VALID Thu Sep 29 16:30:16 MDT 2016:INFO:queryServiceLocationById With Assertion "Match content of [REQUEST_LONGITUDE]" Has Status VALID Thu Sep 29 16:30:16 MDT 2016:INFO:queryServiceLocationById With Assertion "Match content of [ACTUAL_LATITUDE]" Has Status VALID Thu Sep 29 16:30:16 MDT 2016:INFO:queryServiceLocationById With Assertion "Match content of [ACTUAL_LONGITUDE]" Has Status VALID
The idea is to create a log file that can be used for troubleshooting purposes. The project I am currently building may be ran by other people in other locations
- nmrao9 years agoChampion Level 3Would you please check below thread where readyapi writes log files, and see what you are looking for is fulfilled.
Note that, there are different files that it creates.
https://community.smartbear.com/t5/SoapUI-NG/testrunner-bat-log-files-for-Ready-API/m-p/103064#U103064
Related Content
- 10 days ago
Recent Discussions
- 5 days ago
- 9 days ago