Contributions
Using log and context variable from static method
I have a groovy file consisting of class with lots of static method..I want to log information within the static method and also I want to get the project path using context variable(instead of hard-coding the path) but its not allowed. Do I have an alternative?? Some excerpts from code is as below (Pls overlook the typos if its there while copying and pasting) class wbserviceSimulation{ static main(args) { def myclient = new RESTClient('http://127.0.0.1:8080/') myclient.auth.basic("xxx", "yyy") sendDocs(myclient, 'mailpiece', 'domain1', 'user1', 'user111'); } static getProfile(RESTClient client) { --- --- } static sendDocs(RESTClient client, String doc, String mydomain, String normaluser, String toolUser) { //def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context) // def projectPath = groovyUtils.projectPath + '\\tool_attachments\\' def projectPath = 'C:\\myprojects\\tool_attachments\\' def filename= projectPath+'doc.pdf' def meta=projectPath+'doc.xml' ----- ----- //println "filename with extracts " + filename; log.info ("filename with extracts " + filename) } } Trying to use log or context from static method gives an error: ERROR:An error occurred [startup failed: Script13.groovy: 51: Apparent variable 'log' was found in a static scope but doesn't refer to a local variable, static field or class. Possible causes: You attempted to reference a variable in the binding or an instance variable from a static context. You misspelled a classname or statically imported field. Please check the spelling. You attempted to use a method 'log' but left out brackets in a place not allowed by the grammar. @ line 51, column 9. log.info( "filename with extracts" + Filename); ^10 years agoPlace ReadyAPI QuestionsReadyAPI Questions3.4KViews0likes1CommentRe: Running an external sql script file from SoapUi
Hi, Thanks for the reply. But I was looking for a solution which can be achieved by Basic Version and not the ProVersion. I coded a groovy script which could do, what you have suggested but It was way too complicated. It was successful in executing one script line but not all (coz of unavailability of looping). And with also the pro version, I had to first modify the script file (because of so many commented line), the pro version doesn't ignore the comments in the sql query editor(only when it gets the value from property transfer) and complains about the SQL syntax exception when the comment is transferred using property transfer from the script file..phew..... ....Now the effort of mine has shifted to first remove all the comments from the script file (which is bad bad)and then use your suggestions. Let me know, if you have some option (where i don't have to modify my script file) Thanks, Kriti11 years agoPlace ReadyAPI QuestionsReadyAPI Questions2.6KViews0likes0CommentsRunning an external sql script file from SoapUi
hi all, I am able to connect to MySQL database through SoapUI's JDBC feature and perform some simple insert and delete query on the tables. However to make life easier, I have already two SQL files (config.sql and data.sql), which creates schema, tables and fills it. The goal is to "Run both the script file from SoapUI". Is this feature available in basic SoapUI(NOT the PRO Version)? Can this be done, if yes, a guide will be appreciated. By this way, the manual working of updating the database everyday will be reduced. Thanks, Kriti11 years agoPlace ReadyAPI QuestionsReadyAPI Questions3.1KViews0likes2Comments