tobello
11 years agoContributor
dynanic DDT filePath for excelDriver
Hi faulks,
Newbie to TC and would need someone to share anything about this with me,
I'll really appreciate... Getting crazy with this:
Because my test input values in test file might change depending on tester desired, I want the tester to provide the testfile (full path like "C:\\TestFolder\\TestData\\TestFile.xlsx") to a test engine.
Note that the file structure remains the same but only the test values is changeable but the engine is capable of understanding and performing the correct action.
I'm trying to set an Excel DDT driver from the filePath passed from a function
but it does not work as I'm alway getting 'a type mismatch', 'file does not exists', 'excel file does not exisit' or 'property or method is not supportted' errors.
When I try the hardcoded way it's walked fine: Project.Variables.rptTestFile = DDT.ExcelDriver( "C:\\TestFolder\\TestData\\TestFile.xlsx"), "Reports", true);
Here is the function
function setTestDataDriver(testDataFile)
{
var testFile;
try
{
testFile = aqString.Replace(testDataFile, "\\", "\\\\", false);
var aFile = aqFileSystem.GetFileInfo(testFile);
if (aFile.Exists)
{
var aFilePath = aFile.Path;
Project.Variables.rptTestFile = DDT.ExcelDriver(testFile , "Reports", true);
}
}catch(e)
{
Log.Error(e.description);
}
}
Tks in advance
Newbie to TC and would need someone to share anything about this with me,
I'll really appreciate... Getting crazy with this:
Because my test input values in test file might change depending on tester desired, I want the tester to provide the testfile (full path like "C:\\TestFolder\\TestData\\TestFile.xlsx") to a test engine.
Note that the file structure remains the same but only the test values is changeable but the engine is capable of understanding and performing the correct action.
I'm trying to set an Excel DDT driver from the filePath passed from a function
but it does not work as I'm alway getting 'a type mismatch', 'file does not exists', 'excel file does not exisit' or 'property or method is not supportted' errors.
When I try the hardcoded way it's walked fine: Project.Variables.rptTestFile = DDT.ExcelDriver( "C:\\TestFolder\\TestData\\TestFile.xlsx"), "Reports", true);
Here is the function
function setTestDataDriver(testDataFile)
{
var testFile;
try
{
testFile = aqString.Replace(testDataFile, "\\", "\\\\", false);
var aFile = aqFileSystem.GetFileInfo(testFile);
if (aFile.Exists)
{
var aFilePath = aFile.Path;
Project.Variables.rptTestFile = DDT.ExcelDriver(testFile , "Reports", true);
}
}catch(e)
{
Log.Error(e.description);
}
}
Tks in advance