Forum Discussion

karthic's avatar
karthic
New Contributor
14 years ago

data sink

Hi support team,

I am very new to soapui pro and groovy script,
kindly help me in understanding the concept of DATA SINK , i need to store the results of my groovy script/ the xml response in an Excel sheet, i tried my best, but unable to succeed.
I see two browse options in the data sink step with "excel" file option,
1) File 2) Out file
what is the difference between them, please let me know how to write my response to the excel sheet.

thanks,
karthic

8 Replies

  • karthic wrote:
    Hi support team,

    I am very new to soapui pro and groovy script,
    kindly help me in understanding the concept of DATA SINK , i need to store the results of my groovy script/ the xml response in an Excel sheet, i tried my best, but unable to succeed.
    I see two browse options in the data sink step with "excel" file option,
    1) File 2) Out file
    what is the difference between them, please let me know how to write my response to the excel sheet.

    thanks,
    karthic


    Hi Karthic!

    I think that we could make this a lot more easy to understand in soapUI (and I've reported this to the developers).

    This TestStep uses File as a template Excel file (may be a blank file) and writes the values of the TestStep Properties to that Excel sheet starting at cell specified in Start at cell. This is all saved as a new Excel file (whose name is specified in Out File).

    Just wanted to give you a general tips as well: You can often click on a blue question mark to get to the relevant documentation chapter


    Hope this helps!

    Henrik
    SmartBear Sweden
  • karthic's avatar
    karthic
    New Contributor
    hi all,


    hope anyone can help me on this issue.. please.


    thanks,
    karthic.
  • Westpac_Banking's avatar
    Westpac_Banking
    Occasional Contributor
    Hi,

    Can you please let me know how to fetch the number of Rows of data added in the datasink after that step is executed?

    Regards,
    Udhaya
  • Hi Udhaya,

    Unfortunately this isn't available via the API - please add a feature request in the Feature Request Forum Board so we add this in the future.

    For now you could add a DataGen teststep with a number property that starts a 1 just after the DataSink - set the value of the Start to 1 and Mode to Step - the property will have the number of times the DataGen was executed.

    Does that make sense?

    regards!

    /Ole
    SmartBear Software
  • Westpac_Banking's avatar
    Westpac_Banking
    Occasional Contributor
    Hi Ole,

    Sorry for the confusion, I mistakenly mentioned as Datasink instead of DataSource. Below is the correct question.

    Can you please let me know how to fetch the number of Rows of data added in the datasource after that step is executed?
    I am trying to use the steps as attached

    Datasource - Fetch all the data's from the excel
    POS_RIPC_Indv - Executes with the data from the data source
    Groovy Script - Need to write script to save the number of records in the Datasource
    Datasink - Fetches the RawRequest and Response from the test step POS_RIPC_Indv and save it to an Excel sheet.
    DataSource Loop - Loop Datasource to fetch the next row of record.

    Basically I wanted to run the POS_RIPC_Indv test step and save all the request and response in a single excel sheet in consecutive rows.
    As of now whenever Datasink step executes it over rites the value in the 1st row. So I want to pass the row number dynamically based of the no or rows of data in the Datasource.

    Can you please help me to achieve this.

    Regards,
    Udhaya
  • Hi,

    so if I understood you correctly you want to access some counter inside DataSource, but there is no such a counter but it can be simulated. In your groovy step add variable for example myCounter which if not exist is initialized and incremented. Next time just fetch the same variable and increment it. The code can look like this


    if( !context.hasProperty("myCounter") ){
    context.setProperty("myCounter", 0)
    }

    def myCounter = context.getCounter("myCounter")

    myCounter ++

    context.setProperty("myCounter", myCounter )

    // use this variable in you groovy script


    Hope this helps

    regards
    nebojsa
    SmartBear Software