Contributions
Re: read data from text file
my testdata.doc file contains - Line1 Line2 Line3 Line4 Line5 Line6 Line7 Line8 Line9 Line10 def list = [] def f=new File( "C:\\testdata.doc" ) f.eachLine { line -> list.add( line ) } log.info "start" log.info list[0] log.info list[1] log.info list[2] log.info list[3] log.info list[4] log.info list[5] log.info list[6] log.info list[7] log.info list[8] log.info list[9] log.info list[10] The above program displays results with strange characters... any idea? any other way to read file sequentially line by line?? or reading excel would be best! please post the code if u have, or suggest!2.4KViews0likes0CommentsRe: how to modify request ??
Thanks for reply, AnandKiran Yes i wanted to do it through groovy. It's done now. :-) def request = testRunner.testCase.getTestStepByName( "GetActiveVehicles - Request 1" ); //log.info request def property = request.getProperty("request"); //log.info property def node = new groovy.util.XmlParser(false,false).parseText(property.value); //log.info node //def textNodes = node["soapenv:Body"][0].children() //log.info textNodes def textNodes = node["soapenv:Body"]["tem:GetActiveVehicles"]["tem:OperatorId"][0].children() log.info textNodes // modify textNodes.clear(); textNodes.add( "test" + 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 property.setValue( writer.toString() )602Views0likes0Commentsread data from text file
Hi, I just started using soapui... very much new to this tool.. I wanted to read data from a file called test data.txt. I stored this file on C:\ Following command gives - file not found exception.. new File( "C:\\testdata.txt" ).eachLine { line -> list.add( line ) } Whats wrong? Please help.4.4KViews0likes3Comments