Populate string inside Excel Data Sink fields from groovy script
Hey,
Context : Let's say that I have appended a DataSink Teststep manually which I have named "DataSink", feature which is provide naturally in the UI of ReadyAPI.
Now, I would like to get this object instance and feed it regarding my environment execution. I have already known how to get the environment settings so the issue is only how /what are the statements to set DataSink parameters from a groovy script Teststep.
On SoapUiPro documentation, I have found this :
http://www.soapui.org/apidocs/pro/com/eviware/soapui/impl/wsdl/teststeps/datasink/ExcelDataSink.html#setFileName-java.lang.String-
First, I would like to be able to use these metods setFileName(path), setOutFileName(path), setWorksheet(worksheet), setStartCell(startCell) in order to provide the parameters to the DataSink instance.
I also would like loading properties from my first row of the ExcelFile and keep only those I want but in the class
documentation, I do not see any metod to add properties to the DataSink.
Does anyone have an idea of how to achieve both purposes?
Regards,
Harold
The first part you can handle by setting up the following groovy script:
def dataSink = context.testCase.testSteps["DataSink"]; def excel = dataSink.getDataSink();
You would use the details on the link you posted on the excel variable to adjust the file paths and settings specific to the Excel data source. Example:
excel.setFileName("C:\\temp\\Book1.xlsx");
You would use the dataSink variable to adjust the actual properties/values of the Data Sink. Example:
dataSink.setPropertyValue("PropertyName", "This Is My Property Value");
Hope that helps!