We have an application called Job Entry. It takes some of its data from the JobEntryData.csv as shown below.
var csvPath = "C:\\TestData\\JobEntryData.csv";
Driver = DDT.CSVDriver(c...
My best guess is this... You have too many CSV connections open. You need to make sure that, when you're finished iterating through a CSV result set, you use DDT.CloseDriver to close the connection. There is a limitation in the database engine for CSV connections that restricts how many connections can be open.
I see, in your code, you have the call... but it's commented out.
Change that line to DDT.CloseDriver(Driver.Name) and that should work. You need to make sure you have the same sort of call for all your DDT drivers so that you're closing the connection when it's no longer needed
So I figured out how I'm going to have the data structured.
I have individual csv's that supply data to each page of the app.
They'll be queried sort of as you outlined, but I'll pass in a "TestID". This test ID will be what keeps all the csv's in sequence. So all csv's will have a 1 row, 2 row that correspond to each other.
What I do is, I dynamically query and store them in project suite level variables. I then set them to global variables to be used for the test.
This works great except I'm having one issue. I get the following error on the 11th test with a path error for "RxFields.csv"
JSRuntimeError
I've tried recreating the csv, moving the 10th and 11th rows, deleting the 10th and 11th rows, changing the test to run rows 1 through 5, 3 times and it still fails on the 11th test run.
function SetGlobalVariablesFromCSV(csvPath,id,index)
{
//Make sure csv column format is set to text!
let Driver = DDT.CSVDriver(csvPath); <-----This is where it fails every time.
let curDriver = DDT.CurrentDriver.Name;
let csvName = aqFileSystem.GetFileName(csvPath);
var queryByID = 'SELECT * FROM ' + csvName + ' WHERE ' + id + '=' + "'" + index + "'" + '';
Driver.ADOCommandObject.CommandText = queryByID;
let colCount = Driver.ColumnCount;
while(!Driver. EOF())
{
Log.Message("------- Setting global variables for " + csvName + "...-------------------------------------");
for(var i = 0; i < colCount ;i++)
{
var colName = Driver.ColumnName(i);
var colVal = Driver.Value(i);
Log.Message("Column " + i + " name is " + colName);
CreateVariable(colName,"String");
ProjectSuite.Variables.$set("VariableByName",colName, colVal);
}
Log.Message("------------------ Global variables for " + csvName + " are set. -----------------------------") ;
Driver.Next();
}
//DDT.CloseDriver("CSV0");
}
My best guess is this... You have too many CSV connections open. You need to make sure that, when you're finished iterating through a CSV result set, you use DDT.CloseDriver to close the connection. There is a limitation in the database engine for CSV connections that restricts how many connections can be open.
I see, in your code, you have the call... but it's commented out.
Change that line to DDT.CloseDriver(Driver.Name) and that should work. You need to make sure you have the same sort of call for all your DDT drivers so that you're closing the connection when it's no longer needed
Making this code change at the bottom, did in fact solve the issue.
function SetGlobalVariablesFromCSV(csvPath,id,index)
{
//Make sure csv column format is set to text!
let Driver = DDT.CSVDriver(csvPath);
let curDriver = DDT.CurrentDriver.Name;
let csvName = aqFileSystem.GetFileName(csvPath);
var queryByID = 'SELECT * FROM ' + csvName + ' WHERE ' + id + '=' + "'" + index + "'" + '';
Driver.ADOCommandObject.CommandText = queryByID;
let colCount = Driver.ColumnCount;
while(!Driver. EOF())
{
Log.Message("------- Setting global variables for " + csvName + "...-------------------------------------");
for(var i = 0; i < colCount ;i++)
{
var colName = Driver.ColumnName(i);
var colVal = Driver.Value(i);
Log.Message("Column " + i + " name is " + colName);
CreateVariable(colName,"String");
ProjectSuite.Variables.$set("VariableByName",colName, colVal);
}
Log.Message("------------------ Global variables for " + csvName + " are set. -----------------------------") ;
Driver.Next();
}
DDT.CloseDriver(DDT.CurrentDriver.Name);<------------------Actually closing the driver.
}
The funny thing is, I had that in there, but I removed it because it was taking 90 seconds to load my variables. I later realized I had a loop in a loop situation. I fixed that, then didn't put that line back, hence not closing the driver.
I would say that I owe you a beer, but actually I owe you a keg at this point.