Come let us explore together…

Posts tagged ‘TestLog’

Walking through TestComplete logs – Part 3


Hi All,

Let us continue with our “Log” series…

Using logs we can summarize the execution results and send it through mail (As said in previous post) to others and keep them informed the execution results.

I believed few security issues exists in SendMail() function for which I have started a separate thread in Automatedqa Forums.
http://www.automatedqa.com/forums/forum/post/?mode=singlethread&thread=78ec233d-3268-45e1-b7d5-be2803d8cabb

In this post we can dig little deeper in to the log file, where the log information is actually stored. Also we will try to extract the information interested to us.


When you navigate to the log folder, you will find a TestComplete file called “Description.tcLog” from which we can extract a good amount of information


From the above file we can extract information such as ,
1. Who and where the script was executed (Username and System name)
2. Total warning and error count
3. Start and End time of the script

The “Description.tcLog” is an XML file and can get the above values using the script below,

</code>
function GetLogDescription()
{
var tempFolder, xDoc, strTmpValue;
tempFolder = "E:\\Report_TestLog\\";
xDoc = new ActiveXObject("MSXML2.DOMDocument");
xDoc.load(tempFolder + "Description.tcLog");
//User Name
strTmpValue = xDoc.selectSingleNode('Nodes/Node[@name="root"]/Prp[@name="user name"]/@value').text;
Log.Message("User Name: " + strTmpValue);

//Computer Name
strTmpValue = xDoc.selectSingleNode('Nodes/Node[@name="root"]/Prp[@name="computer name"]/@value').text;
Log.Message("Computer Name : " + strTmpValue);
//Warning count
strTmpValue = xDoc.selectSingleNode('Nodes/Node[@name="root"]/Prp[@name="warning count"]/@value').text;
Log.Message("Warning Count : " + strTmpValue);
//Error count
strTmpValue = xDoc.selectSingleNode('Nodes/Node[@name="root"]/Prp[@name="error count"]/@value').text;
Log.Message("Error Count : " + strTmpValue);

xDoc = undefined;
}
<code>

Mostly the management group will be interested in knowing about the overall information about the Automation success rather than individual test cases results.


For such people showing the whole log file may not be the correct way to report, instead we can just summarize the results and show them the numbers – Pass/Fail count.(The above script can solve the purpose)


The TestComplete “Log” object also has few properties which are useful for above purpose. They are,


Log.ErrCount – Reports total number of error in the result
Log.WrnCount – Reports total number of error in the result

We can create folders inside the logs and group similar TestCase/Scenario using Log.CreateFolder function
We can extract log details by each folders which will narrow our reporting,


Log.FolderCount – Reports total number of folders in the log
Log.FolderErrCount – Reports total number of errors in the specified folder
Log.FolderWrnCount – Reports total number of warning in the specified folder

Similarly we have an object under Log object called “CallStackSettings”


Using this object we can Enable (More information about function calls) and Disable (Reduces the log size) call stack settings for TestComplete logs.


Also we can enable/disable the call stack option more accurately to report errors(Log.CallStackSettings.EnableStackOnError), warnings(Log.CallStackSettings.EnableStackOnWarning) etc.,

And as I said early, we can lock(Log.LockEvents) and Unlock(Log.UnlockEvents) any event entering in to the logs.

Hope there is 101 ways to Automate…

Thanks and Regards,
Giri Prasad

Walking through TestComplete logs – Part 2


Hi All, 

Let me continue with my next post in “Walking through TestComplete logs” 

Previous : http://automate101.blogspot.com/2010/06/walking-through-testcomplete-logs.html 

Q2:How was the log useful?
The answer can be found throughout this series of post 🙂 

TestComplete has log panels which can be customized (Added/Delete/Align). The log panels are very informative when you want to investigate the execution. 

The panels in Log explorer are

  • LogItems (Has TestComplete items like Project Suite,Project,Test Items…) 
  • Information (Has time and file information for the current log)
  • Log (Has detailed information about the selected item from LogItems)
  • Remarks (additional information for the selected item in log)
  • Also has – Call Stack, Messages and Extended Messages – I am yet to explore/use this features
Note : When you double-click the a log, it will take you to the code which generates it or to its sub item if clicked on a parent log item.
 Q4:What should be and shouldn’t be in the Log?

According the my understanding a log should convey all the information a user needs. Yes either by default or option to add details in to it. 

By default TestComplete reports an Event, Error, Success, Message, Warning and Picture

In addition to it we can add our own logs using specific functions supplied by “Log” object. 

  

I cannot exactly classify the list of items should and shouldn’t present in the log! It is purely based on the business requirement. 

But importantly TestComplete allows to add our logs in to its TestLog during the script execution and even we can block ( Using functions – Log.LockEvents & Log.UnlockEvents ) the default logs. 

If a test fails, the steps which led to failure must be available and also the event with complete information is that led to failure need to be there in the logs.

Also the log should post respective error/warning messages when the object required is changed/not available/disabled/out of window boundary etc., 

Q5: Is the generated Log can be saved for future reference? If so how?
TestComplete allow us to save/export log both at test run time and completion time. 

During Run Time:
We can save the logs generated at run time (Upto that time) in to (.XML),(.HTML),(.MHTML) formats. 

After run time:
The logs in TestComplete can be exported for reference as (.mhtml), unpacked storage etc. 

Also the results can be viewed in IE (only) from the TestComplete Logs. (Since FireFox and Chrome doesn’t support .mhtml files) 

Other than exporting the logs we can,
  • Create an issue based on failure (Issue tracking must be enabled) 
  • Send the results through email (As .mhtml attachment Using BuiltIn.SendMail method)
Will meet in the next post…
Hope there is 101 ways to Automate…
Thanks and Regards,
Giri Prasad

Walking through TestComplete logs


Hi All,

In this post I talk about my helper named “LOG” (a.k.a. Test Log). A automation script developer knows how crucial is the information in test log is important in resolving a failing script (that’s why called as helper).

TestComplete has an excellent and compact way of reporting the logs resulted from execution of test cases. Reporting functionality of TestComplete is taken care by the object called “Log”. Similar to its name, it is very easy to handle and customize for our need.

“Log” holds many features which cannot be detailed in one post. So I will taking few versions(post) for this feature.

Before starting let me ask few question? (Don’t run… Answering is optional)

  1. Why we need Test Logs?
  2. How is it useful?
  3. What are the basic features a log should have?
  4. What should be and shouldn’t be in the Log?
  5. Is the generated Log can be saved for future reference? If so how?

I think these questions are general to any automation tool and I try to answer my thoughts related to TestComplete.
(Just try to guess some answers and lets see how close/apart we are?)

Q1 : Need for Test Logs?
The main objective of automation is to avoid human intervention during test case execution or Play back. Once the execution is completed we need to know the result. Only based on the execution logs we can determine the success of execution(Sometimes even the whole Automation…).
Just imagine how a developer automate the cases, tester analyze the execution, manager knows QA status and finally how the automation tool will be popularized?

There may be difference in log produced among various tools but is there any tool which doesn’t give any execution logs? (Curios to know!).

I will touch the above questions while going through the log functionality…

Hope there is 101 ways to Automate…

Thanks and Regards,
Giri Prasad