Contributions
Re: How to write a reusable script Library
Hi What if I have two or more classes under "module-name", how can I instantiate all the classes on my groovy script ex. Lib --module-name --example --other_class --other_class2 --other_class3 --.... Other_Test_Suite --TestCase --groovy_script Do I have to do the following?: library = testRunner.testCase.testSuite.project.testSuites["Library"] module = library.testCases["module-name"].testSteps["Example"] module2 = library.testCases["module-name"].testSteps["other_class"] module3 = library.testCases["module-name"].testSteps["other_class2"] .... module.run(testRunner, context) module2.run(testRunner, context) module3.run(testRunner, context) Or there are other ways like: library = testRunner.testCase.testSuite.project.testSuites["Library"] for(int i = 0; i <= [i]number_of_classes[/i]; i++){ library.testCases["module-name"].testSteps[i].run(testRunner, context) } // [i]i[/i] is the order of class under module_name Thanks in advance, Jack11 years agoPlace ReadyAPI QuestionsReadyAPI Questions7.5KViews0likes0CommentsRe: groovyUtils.getXmlHolder treat data as array of characters
nmrao wrote: Ok. But, not sure if you could proceed or still having issue? Hi, what i did was determine first the result of jdbc if how many rows returned, if 1 i just define my variable as String not an Array Thanks, Jack1.6KViews0likes0CommentsRe: groovyUtils.getXmlHolder treat data as array of characters
nmrao wrote: 1. Since housenumber is defined as list in your script, assuming that you might get a list of values 2. what is the result for the assert item instanceof java.lang.String? 1. now i understand...so if i define as list then he treat my data as list: i defined the housenumber as list because i assumed that my JDBC request has 0 or more results. 2. when i assert item if String it returned OK...but when i assert item if Character i got an assertion failed So maybe i do checking first if my JDBC result is 1 or more?1.6KViews0likes0CommentsRe: groovyUtils.getXmlHolder treat data as array of characters
nmrao wrote: Looks the reading does not seem to be good. May be try with housenumber.add(item) And you may also test the class of the value, your case may test with string class for the item for eg: assert list instanceof java.util.List I got same result when i try your code Regards, jack1.6KViews0likes0CommentsgroovyUtils.getXmlHolder treat data as array of characters
Hi Why the data is treat as array of characters rather than array of strings with 1 element, when 1 result returned? Sample: JDBC: <Results> <ResultSet fetchSize="10"> <Row rowNumber="1"> <ADDRESS>North Carolina</ADDRESS> <HOUSE_NUMBER>99000034</HOUSE_NUMBER> </Row> </ResultSet> </Results> Groovy: def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context ); def dbResult = groovyUtils.getXmlHolder('JDBC#ResponseAsXml'); def housenumber = [] for(item in dbResult['//HOUSE_NUMBER']){ housenumber += item } log.info housenumber Actual: INFO:[9, 9, 0, 0, 0, 0, 3, 4] Expected: INFO:[99000034] Regards, Jack2.7KViews0likes6CommentsRe: Property Transfer Source: groovy script, Target: SOAP reques
Thanks Rao, I figured it out!!! groovy Scipt: def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context) def timed = System.currentTimeMillis() def myGeneratedValue = 'test_'+timed return myGeneratedValue PropertyTransfer Test Step: Source: Groovy Script Property: result Target: SOAP request Property: Request Transfer the value from groovy -> soap request SOAP request <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" > <soapenv:Header/> <soapenv:Body> <Reference>"value from groovy script"</Reference> </soapenv:Body> </soapenv:Envelope> Regards, Jack14KViews0likes0CommentsRe: Property Transfer Source: groovy script, Target: SOAP reques
Hi, Uhm, my test steps are the following: GroovyScript --> script to generate data PropertyTransfer --> Source: Groovy Script Target: SOAP Request SOAP Request My goal here is i'm not using any Test Properties of use case, test suite and others as possible Regards, Jack14KViews0likes0Comments