// Exporting the log function GetLogResults() { if(Project.Logs.LogItemsCount > 0) { // Exporting the test log contents try { // note that iteration is only done after the recursive // search method is called and its array returned var arr = FindTestLog(Project.Logs); Log.Message("Logs found: " + arr.length); for(var i = 0; i < arr.length; i++) { Log.Message("Test Log " + i + "exists!", ChildRead(arr[i])); } } finally { Log.Message("Goodbye!"); } } else Log.Message("No logs for export."); } function FindTestLog(Child) { var arr = []; var i, j; var name = ""; if(Child.Scheme != null) { name = Child.Scheme.Name; } // adds object to array if its name == "Test Log" if(Child.Scheme != null && aqString.Compare(Child.Scheme.Name, "Test Log", false) == 0) { arr.push(Child); } // if not, search children/data/rows/etc. for more objects and re-call // concatenating any returned arrays else { for(i = 0; i < Child.ChildCount; i++) { res = FindTestLog(Child.Child(i)); for(j = 0; j < res.length; j++) { arr.push(res[j]); } } for(i = 0; i < Child.DataCount; i++) { res = FindTestLog(Child.Data(i)); for(j = 0; j < res.length; j++) { arr.push(res[j]); } } for(i = 0; i < Child.RowCount; i++) { res = FindTestLog(Child.Rows(i)); for(j = 0; j < res.length; j++) { arr.push(res[j]); } } for(i = 0; i < Child.ChildRowCount; i++) { res = FindTestLog(Child.ChildRow(i)); for(j = 0; j < res.length; j++) { arr.push(res[j]); } } for(i = 0; i < Child.ColumnCount; i++) { res = FindTestLog(Child.ChildDataByIndex(i)); for(j = 0; j < res.length; j++) { arr.push(res[j]); } } for(i = 0; i < Child.LogItemsCount; i++) { res = FindTestLog(Child.LogItem(i)); for(j = 0; j < res.length; j++) { arr.push(res[j]); } } } return arr; } function ChildRead(Child) { var str = ""; switch(Child.Scheme.DataType) { case ldtTable : str += TableRead(Child); // Exporting table data break; case ldtText : str += TextRead(Child); // Exporting text break; default: break; } var i; for(i = 0; i < Child.ChildCount; i++) { str += ChildRead(Child.Child(i)); } return str; } function TableRead(Table) { var TableScheme, Row, i, str; TableScheme = Table.Scheme; if(Table.RowCount > 0) { // Reads only the very last row in a table // (I put a special log entry at the end of every test, meant for export) Row = Table.Rows(Table.RowCount-1); str += RowRead(TableScheme, Row); } return str; } function RowRead(TableScheme, ARow) { var i, str = ""; var Child, ChildRow; var ChildCount; // Exporting child tables data for(i = 0; i < TableScheme.ChildCount; i++) { Child = ARow.ChildDataByIndex(i); str += ChildRead(Child); } // Exporting child rows (if the data is displayed as a tree) for(i = 0; i < ARow.ChildRowCount; i++) { ChildRow = ARow.ChildRow(i); str += RowRead(TableScheme, s, ChildRow); } return str; } function TextRead(Child) { return Child.Text; }