Read and update data in CSV , doesnt pick the recent data

poojapooja Posts: 18

I have to consolidate the report data in csv format.
After each test suite run I update the csv with the latest paremeter value and use this as a datasource to the next test step. However even if the csv is updated somehow it picks the old data present and uses in next test step.
I have also tried deleting the old csv and create new with same name ,still old data picked up when run though CLI command . However sometimes it picks the correct data when run through SOA test .
Let me know how to solve it.



  • OmarROmarR Posts: 209 admin
    edited March 2017

    Good morning Pooja,

    You will need to refresh your Datasource by clicking the "Show Columns" button in your CSV datasource each time that it is updated.

  • OmarROmarR Posts: 209 admin

    Additionally, You can "auto refresh" your datasource by enabling the "Refresh on Access" (Preferred) or the "Enable Refresh using native hooks or polling" feature in Window>Preferences>General>Workspace.

    More information regarding these features are below:

  • poojapooja Posts: 18

    Let me check with refresh option , however I will not open the datasource everytime and check columns since its a automated build through jenkins using CLI command .
    This should be handled in parasoft to pick the latest csv , refreshed data instead of keeping the cached data .

  • poojapooja Posts: 18

    You will need to refresh your Datasource by clicking the "Show Columns" button in your CSV datasource each time that it is updated..
    Is there a way to get it done through automation , I cant do it manually on every run .

  • OmarROmarR Posts: 209 admin

    Would you kindly view my second post regarding "auto" refresh.
    If you do not have access to the workspace GUI, you may also enable this feature through the workspace .metadata folder, specifically in:

  • jakubiakjakubiak Posts: 424 admin

    Let me clarify your testing scenario:

    You have a CSV data source that is pointing to a CSV file on disk. Your test suite is set up as follows:
    Test 1 - uses CSV data source (this could also be a test suite and not just an individual test)
    Test 2 - updates CSV file on disk
    Test 3 - uses CSV data source but wants to use the updated values from Test 2

    If your scenario is similar to what I have described, you will need to structure your tests differently to accomplish what you wish to accomplish. The reason is that all data sources that are needed for a .tst are loaded at the start of the execution for that .tst, and are not read in again while that .tst is being run.

    There are a number of options you could consider:
    1. Move the test that uses the updated value to a .tst file that runs after the first .tst - in this case the second .tst will load the updated version of the CSV when it starts running
    2. If you are only writing/reading a single value/row, then you could use scripting to pass the value through the context that gets passed into the script, or through a test variable

  • poojapooja Posts: 18

    My test is like below
    Test 1 - read data from writable format
    Test 2 - Format it in the form required and write in csv , if the csv is present delete and create a new one .
    Test 3 - Read the data from csv row by row for a service.
    Every run will have new data in csv file.

    I tried keeping the first two test as set up and test 3 as standard . Also tried keeping first 2 test as standard and test 3 as tear down . I kept a delay as well to run the test 3 so that I takes the latest data but it vain as You said the data is loaded at the start of test .
    If I run individually and refresh the test manually , data is picked properly .
    I am running all the three test from CLI command and through Jenkins .The correct data is not picked.

  • jakubiakjakubiak Posts: 424 admin

    Unfortunately you are not able to accomplish what you are trying to do in the same .tst file, since the data sources get read in and cached at the beginning of the test execution. I suggest you try one of the two options I mentioned in my previous post. A third option is to populate the data into a writable data source instead of into the CSV file (or do both if you need the CSV file after test execution has completed).

Sign In or Register to comment.