Ask a Question

Inserting data to excel with Groovy script

New Contributor

Re: Inserting data to excel with Groovy script

will u please explain the above code.i am beginner in  soap ui pro



CL = 0;
rows = sheet1.getRows();
for( tc_row in 1..rows-1){
WritableCell tmpA = sheet1.getCell(CL,tc_row);
String s1 = tmpA.getContents();"$s1")
Label label = new Label(CL,tc_row,s1);

Frequent Visitor

How to save each request and response in file using Groovy .




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 = //get project name
def pDate = new Date().format( 'yyyyMMdd' )//get current date
def sDate = pDate.toString()//convert date to string
def pTestSuite = TestSuite name
def pTestCase = 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 )

Showing results for 
Search instead for 
Did you mean: