Automation is finally heating up at work and its tough to do any automation without reading your test definition files. I wrote mine in TestComplete’s C# scripting. This is a very simple script but why go re-write something if you have a solid base to start from? See the source or download the script file below.
fileContents = GetCSVContents(fileNameAndPath);
fileContentsByLine = SplitCSVContentsOnEnter(fileContents);
lineContents = SplitCSVLineOnComma(fileContentsByLine[lineToSplit]);
for (i = 0; i < lineContents["length"]; i++){
Log.Message(lineContents[i]);
}
return lineContents;
}
function GetCSVContents(filePathAndName){
return aqFile["ReadWholeTextFile"](filePathAndName, 22);
}
function SplitCSVContentsOnEnter(fileContents){
return fileContents["split"](Chr(13));
}
function SplitCSVLineOnComma(lineContents){
return lineContents["split"]("\, ");
}
TestDefinitionReader C# TestComplete Script
Related posts: