Hi Shef, that is not how Test Complete works
When a test is run, every Script Unit in the Project is compiled and a singleton object created for each, meaning that ErrorReporter::vectErrMsgs will only be created once.
Consider the following Script Units:
Unit1.sj
var vectErrMsgs = new Array();
function test001() {
vectErrMsgs.push( "Unit 1" );
}
Unit2.sj
//USEUNIT Unit1
function test002() {
Unit1.test001();
Unit1.vectErrMsgs.push( "Unit 2" );
}
Unit3.sj
Unit3.sj
//USEUNIT Unit1
//USEUNIT Unit2
function test003() {
Unit1.test001();
Unit2.test002();
Unit1.vectErrMsgs.push( "Unit 3" );
for( var j = 0; j < Unit1.vectErrMsgs.length; j++ ) {
Log.Message( Unit1.vectErrMsgs[ j ] );
}
}
When Unit3.sj is run, it will output
Unit 1
Unit 1
Unit 2
Unit 3
proving that Unit1::vectErrMsgs is only created once.
Phil