Contributions
Running a Test Case from groovy script
Hi Ole I want to run a test case. For that I have coded the following. But, I get compilation error. Can you pl. help me testRunner.getTestCase().getTestStepByName("Step getSessionid").run(testRunner, context); println("Finished Executing:"); List stepResult=testRunner.getResults() Iterator j=stepResult.iterator(); while (j.hasNext()) { TestStepResult result=(TestStepResult)j.next(); println("result:"+result.getStatus()) } The error is in "TestStepResult result=(TestStepResult)j.next();" Also can you explain me why is testrunner being passed as parameter in the run method? Thanks Anu2KViews0likes1Comment- 1.5KViews0likes0Comments
Re: executing a step from groovy script
Hi Ole I am using the above script to read and write the properties. After the script is executed, I see the output as thus a1 1 When I try to run this, it does not work. But when I put them in one line as below a1 1 and then execute this step, it works. How do I write it in one line? or how do I take care of this problem. Any help will be greatly appreciated. Anu1.5KViews0likes0Commentsexecuting a step from groovy script
I am passing my parameters to the request object in say "Step 1 - open" using groovy script. How do I run the script. Below is my script // get request property def openrequest = testRunner.testCase.getTestStepByName( "Step 1 - open" ); def openrequestproperty = openrequest.getProperty( "request" ); // parse out textnodes to modify def node = new groovy.util.XmlParser(false,false).parseText(openrequestproperty.value); def textNodes = node["soapenv:Body"]["x:open"]["abc"][0].children() // modify textNodes.clear(); textNodes.add( "test1" + System.currentTimeMillis() ); // write back to string def writer = new java.io.StringWriter(); def printer = new groovy.util.XmlNodePrinter( new PrintWriter( writer )); printer.print( node ); // set property openrequestproperty.setValue( writer.toString() ) testRunner.gotoStepByName( "Step 1 - open" ); Now how do I execute "Step 1 - open". Any help will be greatly appreciated. Anu3.8KViews0likes5Commentsneed help with setNodeValue
Hi, I am new to soapui. I am trying to write a groovy script to read the data from a file and pass them as parameters to the request in the next step. my xml in the second step is as follows bbb aa2 2 10.20.30.40 my groovy script in the first step is as follows def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context ) //create holder for last response an log requistID def holder = groovyUtils.getXmlHolder( "ses:company#request" ) log.info holder.getNodeValue holder.setNodeValue( "//ses:company", "ccc" ) holder.updateProperty() This however is throwing an error Fri Jan 25 18:37:00 PST 2008:ERROR:org.apache.xmlbeans.XmlException: error: Unexpected element: CDATA Can you pl. help me. I do not think I am doing it right.17 years agoPlace ReadyAPI QuestionsReadyAPI Questions6.4KViews0likes1Comment