Forum Discussion

mikev's avatar
mikev
Contributor
12 years ago

System Resources Exceeded

I've figured out my data driven framework.  Basically it has a controller function that controls everything.  I have a fairly large spreadsheet with 11 different data sheets.  This problem arises when I hit the 9th data sheet.  My best guess is that I have too many open connections, but in this framework, I don't see how I can close any of them since the rows themselves won't increment if the datasheet is closed.  If it's not too many connections, then I really have no idea.  IF it is too many connections, I'm failing to see how I can keep track of things if I have to close the connection to a DDT.  Thoughts?



Here is the controller code:





//USEUNIT commonlib

//USEUNIT applib

//USEUNIT ScriptUnit1

//USEUNIT ScriptUnit2

//USEUNIT ScriptUnit3

//USEUNIT ScriptUnit4

//USEUNIT ScriptUnit5     

//USEUNIT ScriptUnit6

//USEUNIT ScriptUnit7

//USEUNIT ScriptUnit8

//USEUNIT ScriptUnit9

//USEUNIT ScriptUnit10

//USEUNIT ScriptUnit11



function Controller() {



//Get the test directory so we know where our datasheet is.

var testDir = Project.Path;

var testData = testDir + "\\Default.xls";



//Set up the data drivers, specific to the sheet we want to use.

var Sheet1 = DDT.ExcelDriver(testData, "Sheet1");

var Sheet2 = DDT.ExcelDriver(testData, "Sheet2");

var Sheet3 = DDT.ExcelDriver(testData, "Sheet3");

var Sheet4 = DDT.ExcelDriver(testData, "Sheet4");

var Sheet5 = DDT.ExcelDriver(testData, "Sheet5");

var Sheet6 = DDT.ExcelDriver(testData, "Sheet6");

var Sheet7 = DDT.ExcelDriver(testData, "Sheet7");

var Sheet8 = DDT.ExcelDriver(testData, "Sheet8");

var Sheet9 = DDT.ExcelDriver(testData, "Sheet9");

var Sheet10 = DDT.ExcelDriver(testData, "Sheet10");

var Sheet11 = DDT.ExcelDriver(testData, "Sheet11");



//Since all sheets must have the same number of rows, we can use the

//intial sheet as the EOF check.  If this sheet is EOF, all of them are.

while (!Sheet1.EOF()) {



  //First thing we need to do is get the Run Flag.  If it's 'N' we are not

  //running this iteration.

  var RUN_FLAG = Sheet1.Value("RunFlag");

  var myVar = Sheet1.Value("Val");

  if (RUN_FLAG == "N") {

    Log.Message("Skipping this iteration: " + Sheet1.Value("Val"));  

  }

  else {

 

  //Write a log so that we know which row we are on.

  Log.Message("**************     Running test " + myVar  + " **************");

         

  //Set the ScriptUnit1 values.

  ScriptUnit1Tab(Sheet1);

 

  //Set the ScriptUnit2 values.

  ScriptUnit2Tab(Sheet2);

 

  //Set the ScriptUnit3 values.

  ScriptUnit3Tab(Sheet3);

 

  //Set the ScriptUnit4 values.

  ScriptUnit4Tab(Sheet4);

 

  //Set the ScriptUnit5 values.

  ScriptUnit5Tab(Sheet5);



  //Set the ScriptUnit6 values.

  ScriptUnit6Tab(Sheet6);

   

  //Set the ScriptUnit7 values.

  ScriptUnit7Tab(Sheet7);

 

  //Set the ScriptUnit8 values.

  ScriptUnit8Tab(Sheet8);

 

  //Set the ScriptUnit9 values.

  ScriptUnit9Tab(Sheet9);

 

  //Set the ScriptUnit10 values.

  ScriptUnit10Tab(Sheet10);



  //Set the ScriptUnit11 values.

  ScriptUnit11Tab(Sheet11);

 

    }

    //Increment all rows for every sheet.

    Sheet1.Next();

    Sheet2.Next();

    Sheet3.Next();

    Sheet4.Next();

    Sheet5.Next();

    Sheet6.Next();

    Sheet7.Next();

    Sheet8.Next();

    Sheet9.Next();

    Sheet10.Next();

    Sheet11.Next();

}



}  // End of Controller



Here is an example script unit:



//USEUNIT commonlib

//USEUNIT applib



function ScriptUnit1Tab(Driver){



//Set up our local variables from the Sheet1 sheet.  

var var1 = Driver.Value("var1");

var var2 = Driver.Value("var2");

var var3 = Driver.Value("var3");



//Function calls to do things specific to the data in the sheet.



}//End of function

1 Reply

  • OK, I've figured out the "solution".  I was passing a wrong sheet (copy/paste) and when the script unit was looking for the field value, the "System Resources exceeded" exception was thrown.  That's a pretty poor message to throw when the code can't find the column in the datasheet...........