Possible to use csv file for variables in script?
Hi all,
I'm attempting to use a csv file containing variables in a scripted function in order to use the variables within the csv file to generate a connection string.
I've had a good look around, but cannot see anything obvious around using variables within a csv file for a script, other than for running data driven tests.
To be clear, I have a csv file with variables which I wish to use to form a connection string in a function, rather than using project variables or any variables within test complete.
The objective of this is so that when the repository is pulled, users do not have to manually change variables each time from someone elses commit and to use a fixed non-tracked file held locally to each user.
Many thanks,
Tristan
Rather than a CSV, consider using an INI file.
https://support.smartbear.com/testcomplete/docs/reference/program-objects/storages/ini.html
If you need to use a CSV, you can open a text file using OpenTextFile and other methods of the aqFIle object and read lines from the CSV. You can then use aqString.GetListItem to grab a value from the comma separated fields in the row, assuming you set the ListSeparator property to a comma.
https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqfile/opentextfile.html