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
It's probably the escape characters for the string... PITA, yes, but once you get that SQL query figured out, you're golden.
I use this method of querying CSV files frequently. It's more portable than using an SQL database and anyone can access and edit it... really nice for building out an automation framework.
Let me know how it works out for you and if you need any further help.
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");
}