Forum Discussion

HaroldR's avatar
HaroldR
Contributor
7 years ago
Solved

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 thi...
  • groovyguy's avatar
    7 years ago

    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!