Add suite folder for Data

I’ve added a folder called Data to my suites to contain sets of test data and obscured passwords. I’ve tried to reference them from my scripts but have had no luck to date; reading them from my desktop is no problem (e.g., put line 1 of file “~/desktop/test_password.txt” into password ). If this doesn’t already exist, could you add a simple way to cluster test data with their test suites?

Many thanks, Bruce

Yeah that would be pretty nice

I had the same idea that you did and do the following that you may/ may not do already to get to files in the data folder

I declare a universal var called dataFolder at the top of each script/function

then assign to dataFolder like so…

put chars 1 to -8 of my directory & "Data" into dataFolder

and then reference any file I want like so

put file dataFolder & "/file.txt" into var1

Hi, Bruce:

This is an intriguing idea and we’re discussing it. In the meantime, here’s some info to keep you going:[list]
[*] You can find out what the current “working” directory is by running the following command:

put the directory

[*] You can set the current working directory with this command:

set the directory to "path/to/my/directory"

[] If you haven’t specifically set the working directory, it defaults to the default directory for saving suites.
] You can get the parent directory of a script by asking for its folder (or directory):

put my folder

You could then easily refer to a folder at the same level in the Suite as the Scripts folder with the following code:

put my folder into dataFolder
put "Data" into the last item delimited by "/" of dataFolder
// gives you "/path/to/my/suite/Data"

The dataFolder variable now refers to a folder called Data at the top level of the current Suite.[/list:u]
Thanks for the suggestion. I hope these tips help.