Ask a Question

How to write logo information into a variable or table?

rhu
Occasional Contributor

How to write logo information into a variable or table?

When searching for Testcomplete Examples i often find Examples writeing results to log file(s).

 

How can i write this information into a variable or a Table


E.g. a function that searches for files in a directory and writes the file name into the log:
What do i have to do to write the information into a variable or Table?

function FileFinder()
{
var foundFiles, aFile;
foundFiles = aqFileSystem.FindFiles("C:\\Users\\imyuser\\Downloads\\","response_*.json");
if (!strictEqual(foundFiles, null))
while (foundFiles.HasNext())
{
aFile = foundFiles.Next();
Log.Message(aFile.Name);
}
else
Log.Message("No files were found.");

2 REPLIES 2
rraghvani
Contributor

Assuming you're using JavaScript, store the object returned into an Array. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array for example.

 

var filenames = [];
...
filenames.push(aFile.Name);
...
SBegley
Staff

Hi @rhu,

 

I hope you are keeping well.

 

There is the LogTableData Object as per following description;

SBegley_0-1655804536555.png

Within the following documentation there is a code example that obtains the total number of the specified log item's rows and then posts the values of all the rows to the test log.

 

Please let me know if this resolves your query or if you have any additional questions.

 

Thanks,

Shane

cancel
Showing results for 
Search instead for 
Did you mean: