When testing on several different computers, there sometimes arises a necessity to use various testing data or parameters. It may depend on the version of the operational system, its bit-rate, or it can even be different for every computer.
The simplest method to use different testing data in such cases is having data sets for each particular case—each time reading the data from the appropriate file.
Let's suppose, we have a file settings.ini
, that contains all the preset parameters for the tests, to be declared in the code as follows:
var file = "settings.ini"; // code for settings read
At the point of launching tests on various operational systems, it turned out that each OS requires different settings.
To read supply settings from different files depending on the OS version, it is necessary to perform the following steps:
settings.ini
file with the following names: WinXP.ini
, WinVista.ini
, Win7.ini
, and Win8.ini
.var file = Sys.OSInfo.Name + ".ini";
The OSInfo.Name
parameter returns a short name of the current operational system. The unbridged name of the OS is possible to obtain from the OSInfo.FullName
property.
Similarly, it is possible to organize reading the data for other cases of the kind. For example, if the data differs for every computer, the file names can be given by computer name, while variables could be created via the
Sys.HostName
property.
In case of the Data-driven Testing (DDT) approach, it is possible to store the data for different operational systems on different pages of the document, each corresponding to the proper operating system.