Forum Discussion

royd's avatar
royd
Regular Contributor
9 years ago
Solved

Global variable trouble!

Hello everyone

 

I am having serious trouble with Global vaiebles! In the past, I did use Global variable successfully. Only difference this time is, I have 3 Global variable coming from UnitA to UnitB and 3 Variables coming from UnitB to UnitC (one new from UnitB). I have wasted much time last week, can not figure out the problem!

 

I am using TestComplete 12 with JScript. Here is my setup:

 

UnitA(with UnitB reference)                    UnitB(with UnitC reference)                     UnitC

 

and . . .

 

UnitA:

 

var fName
var securityC
var getURL


function atHomePatient(){

  Browsers.Item("iexplore", "", Browsers.pX86).Run("https://<url>");

. . . 

//select department
Aliases.browser.pageHIS.aspNet.sDept.ClickItem(patient.sDept);

//set admission date
Aliases.browser.pageHIS.aspNet.aDate.SetText(patient.aDate);

//set patient name
Aliases.browser.pageHIS.aspNet.pName.SetText(patient.pName); //i.e: John Smith
fName = patient.pName.split(" ")[0];
Log.Message("Split first name is: " + fName);

//set DOB
Aliases.browser.pageHIS.aspNet.pDOB.SetText(patient.pDOB);  

. . .

}

UnitB:

 

function patientSignOn(){

Log.Message("Patient's Name is: " + fName);
Log.Message("Security code is: " + securityC);
Log.Message("Signup url is: " + getURL);

. . .

}

Here is the structure of my project:

 

All three reported 'undefined' in UnitB!

 

I would really appreciate any help!

 

Thanks.

 

Dave