Forum Discussion

Darshika's avatar
Darshika
New Contributor
3 years ago

Unable to Write Response in Excel using Data Sink

Hi All ,

I am facing issue in writing the response data in Excel using Data sink .

Actually I have added the Data sink test step at the end of Data Source loop as I  need only the last received  response of the API  & use them in the next APIs requests (Basically Writing the Response in Excel  using Data sink & then using that response as a value through Excel Formulae whenever required in further APIs).

Here Data Sink is working fine when run individually but when try to run the Complete Test Case including Data Source , Rest Request , Data Source Loop & Data sink test steps then required response is not showing written in the Excel while when check the Data Sink test step in ReadyAPI , it is showing Passed & response is also showing fetched in Data log but same is not showing written in Excel sheet .

 

Note:-I have already provided Full rights on that Excel for the user through which i have logged in to the system so there is no Rights Related issue .

 

I am using ReadyAPI 3.30.0 Licensed version .

Please Find attached screenshots for more clear understanding the issue which I am facing .

 

 

 

 

 

 

 

  • ChrisAdams's avatar
    ChrisAdams
    Champion Level 3

    Hi,

    Late to this one, but have you tried changing your datasink to the File (CSV) type?  I've had issues writing to Excel and switched to writing to a text file.

    • MFWebb's avatar
      MFWebb
      New Contributor

      Likewise.  I've also switched to .csv format when using multiple data sink steps in the same test...excel doesn't like that at all.

  • richie's avatar
    richie
    Community Hero
    Hey Darshika,

    It's been a while since i last played with DataSink objects, but from what i remember your DataSink might be in the wrong position in your hierarchy.

    If you move it immediately before the DatasourceLoop object and uncheck the 'Append' flag, "i think" that it would write each url to the same position each loop (overwriting each time) resulting in the final loops URL being saved to the spreadsheet.

    Or....rather than bother with a DataSink, you could use Properties (TestCase or TestSuite properties) instead....i.e. write each loop to the same property and then it would only persist the final loops URL (cos each time the loop writes, the previous loop would be overwritten)

    If what i suggested with the DataSink doesnt work (and no one else has any better ideas) and you only want to use DataSink rather than Properties, send a message back and i'll set it up on my machine and i'll work out how to do it, but you have a number of options how to do this.

    Cheers,

    Rich
    • Darshika's avatar
      Darshika
      New Contributor

      Hi richie ,

       

      I have already tried the Data Sink placing before the Data Source Loop but still the Response  data is not written in the Excel.

      I can't use the Properties test step as of now as i am preparing the Regression test suite in which positive as well negative test cases are executed based on the flow defined in Excel  .

       

      Here I am trying to  give you the brief idea what is exactly my approach in ReadyAPI so that you can assist me :-

      We have around 100 APIs & we are  validating the response of  APIs using Assertions with multiple  Negative as well as Positive data sets (Regression Testing) so to achieve this we are using Excel workbook & concept of Data source to Read Excel & Data Sink using  which we are trying to write the Response data in a separate sheet & picking these  values using basic formula of Excel in any another sheet which is further used as a Data source of next APIs

      We have Positive as well as Negative data set in same sheet along with the assertions which are matching at run time & marking test case as Pass or Fail.

       

      If we use Properties Test Step then every time positive value will be passed in Next APIs which is not handling my cases properly because I Have to test field with different kinds of data including negative or invalid data as well as .

       

       

       

      • richie's avatar
        richie
        Community Hero
        Hey Darshika,

        Ok....i'll try and have a look at this tonight sometime.

        BTW, ChrisAdams made a very valid point however that id forgotten. Because of all the problems i found using spreadsheets i stopped using them about 3 years ago for any DataSourced/Looped test. I only ever use csv's now cos of the problems i found.
        I admit csv's dont support multiple tabs (like a spreadsheet), however if you can bite the bullet and separate out your tabs into individual csv's, thatll save you a lot of hassle. You can still edit and manipulate your data in Excel, but sourcing data from a pure text file is a LOT easier ive found.

        Just something to think about....

        Cheers,

        Rich