Contributions
Re: Inserting data to excel with Groovy script
Hi, Using SoapUI Open Source. How to save each request and response in file , when input the data from Excel. I tried but I can only save first input from excel (Request and response).can anyone help on this please. This my code: def res=context.expand('${GetProduct#Request}') new File("C:/Users/Psandhu/Req/REQUESTDATA.xml").write(res) def myOutFile = "C:/Users/Psandhu/RES/RESPONSEDATA.xml" def response = context.expand( '${GetProduct#Response}' ) def f = new File(myOutFile) f.write(response, "UTF-8") Second Code I tried this, but give me error for : Groovy.Lang>missingPropertyException: No such Property:tetsStepresult for class def pName = context.currentStep.testCase.testSuite.project.name //get project name def pDate = new Date().format( 'yyyyMMdd' )//get current date def sDate = pDate.toString()//convert date to string def pTestSuite = context.currentStep.testCase.testSuite.name//get TestSuite name def pTestCase = context.currentStep.testCase.name//get TestCase name def filePath = 'C:/Users/Psandhu/'+pName+'_'+sDate+'/'+pTestSuite+'/'+pTestCase+'/'//compose the folder path // File file2 = new File(filePath) if (!file2.exists()) file2.mkdirs()//create the destination folder // // fos = new FileOutputStream(filePath+ testStepResult.testStep.label + '.txt', true) pw = new PrintWriter( fos ) testStepResult.writeTo( pw ) pw.close() fos.close()1.2KViews0likes0Comments