Forum Discussion

asthay's avatar
asthay
New Contributor
5 years ago

Reloading datasource values at runtime

I have to test 2 API's in 1 test suite.I have to run a testcase and store the result using data sink and transfer the values to an excel sheet and in the same test case try to reload those excel sheet values it doesn't get the new values rather it gives the previous values. I need to pass the stored values in the test case due to which it fails. I have attached the flow wherein I have to pass values from Add Resource to saveResourceId. Then take values from ResourceIdData and pass it to Delete Resource test case.

 

Thanks in advance ๐Ÿ™‚

 

 

  • nmrao's avatar
    nmrao
    Champion Level 3
    What is your use case ? If the runtime data needs to be used, then I guess writing them to file and reload can be avoided if more details available regarding the test flow.
    • sonya_m's avatar
      sonya_m
      SmartBear Alumni (Retired)

      Thank you for great suggestions Community!

       

      asthay have you tried the approaches mentioned? Please share you results๐Ÿ™‚

  • richie's avatar
    richie
    Community Hero
    Hi asthay,

    Why are you using a datasink to pass values onto subsequent steps?

    Why not do the prop xfer to a Properties step? I don't use data sinks that often, but when ive used them before it tends to be as the final step in my test to save parm values. If im reusing parm values later on in a test, i either xfer the property values directly to the subsequent REST/SOAP steps or i save the parm values in a Properties step instead. Have you tried this approach?

    Cheers

    Rich
    • asthay's avatar
      asthay
      New Contributor

      Hi Richie,

       Thanks for your reply. I tried this approach also. But when I used groovy script to get those values it throws an error even though it loads all the values from property transfer and also when I tried to pass those values to DELETE API I wasn't able to load the values in that API. After that only I went with the approach to use data sink. 

      • richie's avatar
        richie
        Community Hero
        Hey asthay,

        I wasnt suggesting using groovy (although its easy to do using groovy) as the native functionality (property expansion / prop transfer / Properties step handles) handles what you need to do without any problems.

        If you tried with groovy and you publish the script i can have a look to see the problem?
        Or replace your datasink step with Properties step as the datasink step is used to store data in files. I just double checked and the help makes no mention of using the properties created in a datasink step to reuse the properties, so im thinking yourr not using the datasink step im the way the help suggests.

        Im typing this out on my phone so cant see your first post, but are you sure youre using a datasink mid test rather than a datasource step?

        We arent really gonna be able to help much more without seeing your property transfers and requests and responses and logging.

        Nice one

        Rich