Contributions
Re: Unable to call Java method using groovy script
Thank you Rao. After adding static keyword , it worked. We are so blessed to have guys like you in the forums who always comes forward to share the knowledge. Truly appreciate your support and commitment. I will also look into your suggestion of using of groovy instead of Java . I was working on existing framework that was created few years back to make it work again. Thanks, Ravindra.Ch3.8KViews0likes1CommentUnable to call Java method using groovy script
All, I have created jar file with name readXML.jar and placed the jar file in bon/ext folder. I have the imported the package and called the required java method as below import readXML.readXMLResponse def StrXML=context.testCase.testSuite.project.testSuites["Services"].testCases[ServiceName].testSteps[methodname].getPropertyValue("ResponseAsXML").toString(); log.info StrXML; def tagname=context.testCase.testSuite.getPropertyValue("OUTPUTTAG") log.info "tag name is :$tagname" readXMLResponse xml1= new readXMLResponse(); ArrayList alist=new ArrayList(); alist=readXMLResponse.GetData(StrXML,tagname); During execution in soapui, I am getting below error. Note I checked calling this method in eclipse and it worked fine. ERROR:groovy.lang.MissingMethodException: No signature of method: static readXML.readXMLResponse.GetData() is applicable for argument types: (java.lang.String, java.lang.String) Please find the attached document that contains content of the jar file. Thanks, RavindraSolved3.8KViews0likes3CommentsRe: Issue in invoking rest method from another test suite using groovy script
After I followed the suggestion provided by another user i the forum , it worked like charm. Thank you Rao. def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context ); def testCase = testRunner.testCase; def testStep = testCase.getTestStepAt(0); //def testStep = testCase.getTestStepByName("Delay"); //def testStep = testCase.testSteps["Delay"]; testRunner = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner(testCase, null); testStepContext = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext(testStep); testStep.run(testRunner, testStepContext);2.5KViews1like0CommentsRe: Running TestSteps
Finan, I know it is old post but you have saved me and thought of saying Thank you. I was struggling to execute the test step where it is executing the test step but not passing the parameters. But after I followed your approach it worked like charm. Thanks, Ravindra.Ch1.5KViews1like0CommentsRe: Issue in invoking rest method from another test suite using groovy script
I am creating and setting properties values in the test case during run time..I checked and those properties are set correctly. Manually I have refereed those values in rest method as${#TestCase#userid} .Please let me know if you need any more information. Thanks once again for looking into the issue. myTestCase.setPropertyValue(inputtagList,inputValueList) def x = myTestCase.getPropertyValue(inputtagList) log.info " x: $x" Thanks, Ravindra2.5KViews0likes3CommentsRe: Issue in invoking rest method from another test suite using groovy script
Thanks RAO for the response . I have tried this earlier and now also and got the same result.Let me share more details that might help in providing suggestions to this issue. When I invoke the rest method through groovy script, it looks like it is not passing parameter values. request: GET /DataVisionService/dh/login// HTTP/1.1 DEBUG:Receiving response: HTTP/1.1 404 Not Found But when i execute the same request by clicking run button, it is successfully passing parameters and executing the request correctly. DEBUG:Sending request: GET /DataVisionService/dh/login/userid/password HTTP/1.1 DEBUG:Receiving response: HTTP/1.1 200 OK Please find the attached screenshot of parameter substitution. Thanks, Ravindra2.5KViews0likes5CommentsIssue in invoking rest method from another test suite using groovy script
HI All, I am facing issue where i am unable to invoke rest step that exists in another test suite. When I ran the script, i am always getting "End point url not found". But when I execute the same step directly by clicking Run button it is working fine. Here is the code that i used to invoke rest method from another test suite in same project. ServiceName=context.testCase.testSuite.getPropertyValue("Service") methodname=context.testCase.testSuite.getPropertyValue("Method") context.testCase.testSuite.project.testSuites["Services"].testCases[ServiceName].testSteps[methodname].run(null,context) I double checked the values printed in the log and it looks good. Not sure what's wrong with the above step. Please find the attached screenshots which might help in understanding the issue. Any help is greatly appreciated.2.5KViews0likes7CommentsException while reading excel data through POI in soapui
Hello, I reading the data associated to web service from excel using third party API(apache POI). I executed the script the groovy console and it worked fine. But when I execute in SOAP UI groovy step, getting following error: ERROR:org.apache.poi.POIXMLException: java.lang.reflect.InvocationTargetException Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.poi.POIXMLTypeLoader import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; class ExcelReader { public XSSFWorkbook workbook = null; public XSSFSheet sheet = null; public XSSFRow row1; public int rowcount; public String testplanpath; def readRowCount(String FilePath) { def rowCount def path path = FilePath; InputStream inputStream = new FileInputStream(path); workbook = new XSSFWorkbook(inputStream); sheet = workbook.getSheet("Sheet1"); rowCount= (sheet.getLastRowNum() - sheet.getFirstRowNum() + 1); rowCount; } } def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context) def myTestCase = context.testCase def Tpath def rcount Tpath="D:\\POC\\API Testing\\TestPlans\\Testplan3.xlsx" ExcelReader excelReader = new ExcelReader(); rcount = excelReader.readRowCount(Tpath); log.info "row count is : $rows" Please find the attach detailed error log.1.6KViews0likes0CommentsRe: Unable to set Rest URI template parameters using groovy script.
Finally I am able to do it by going throughRestTestRequestStep API class. Thanks for the user in the below link who has directed me to correct API class. http://stackoverflow.com/questions/32120209/how-to-get-request-property-in-soap-ui-for-rest-service-test Incase if any one having same problem, below is the solution i have followed to set REST request parameter values through groovy code.. counter =0; firstTestStep =context.testCase.testSuite.project.testSuites["Services"].testCases[ServiceName].testSteps[methodname] if(firstTestStep instanceof com.eviware.soapui.impl.wsdl.teststeps.RestTestRequestStep) { /def parameters = firstTestStep?.getTestRequest()?.getParams() // loop through the map parameters parameters.each { k,v -> // for each params print the name and the value def param1="$k" log.info param1 log.info "value of k is :$k : ${v.getValue()}" if (counter<tagsize) { parameters.setPropertyValue(param1,inputValueArray[counter]) counter++ } } Thanks, Ravindra.Ch8 years agoPlace ReadyAPI QuestionsReadyAPI Questions3.1KViews0likes0Comments