Reading from properties file.
I am new to Winrunner scripting. My script requires several configurable values such as user name, password for the application and the gui map location. These values will be available in a properties file in the following format.
Is there any easy way of reading these values in Winrunner script? I checked the online reference and found file_getline. This method will allow me to read the lines sequentially but my properties may be specified in any order as long as the key-value mapping is maintained. Is there any way I can easily read the properties in the above format using any Winrunner functions?
Re: Reading from properties file.
You need to use the eval function. Here is an example:
</font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">function read_properties(in properties_file)
auto line,array, rc;
if((rc = file_open(properties_file,FO_MODE_READ)) != E_OK)
while(file_getline(properties_file,line) == E_OK)
if(split(line,array,"=" == 2)
eval(array & "=\"" & array & "\";"
}</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">