Forum Discussion
hhagay
9 years agoContributor
Thank you guys:
Following NisHera request, here is the structure of my framework.
Every driver script has the following:
- Requires libs
- Reads config.js
- Parses data from Excel into variables to be used in the script
/**
* require
*/
var spLib = require("spLib");
.........
..........
/**
* READING FROM CONFIG FILE
*/
var envConfig = require("config_env");
var urlAUT = envConfig.url;
var environment = envConfig.environmentName;
......
......
/**
* READING EXCEL
*/
var testdataArray = [];
var myDataSet = spUtils.ReadFromExcel(datafilefromconfig, datasheetfromconfig, sPath, function(data){return data;});
var dataToSplit = myDataSet.split(",");
for (i in dataToSplit)
{
testdataArray.push(dataToSplit[i]);
}
var count = dataToSplit.length;
var adminName= dataToSplit[0];
......
......
I would like for these variables that I create from reading the excel sheet, to be globally available to any driver script. In other words - I want to eliminate the need to keep reading the excel file everytime I create a driver script.
So, much like we export (module.exports) our functions making them available to all AND require (require) them from a calling function -- I would like to be able to make a variable "global" and have the ability to call it from any script.
I hope this makes sense.
Thank you
hhagay
9 years agoContributor