Writing messages to the log

A log is a file that contains the record of events that occur while a Functional Tester script is playing back. There are several different methods you can use to write messages to the log.

Functional Tester supports several types of log files, or no logging at all. You select the type of log file (TestManager Log, HTML Log, or Text Log) through the user interface. Each logged event has an associated message. In a TestManager log, you can see this message by right-clicking the event in the log and selecting Properties.

Functional Tester automatically logs the following events:

To include your own general messages in whatever type of log you specified through the user interface, use the logInfo method, as shown in this example:

if(AnAWTButtonButton(p1,0)isEnabled())
{
    logInfo("AWT button is enabled.");
} 
else 
{
    logInfo("AWT button is not enabled.");
}

You can log a test result by using the logTestResult method. The first parameter is a headline that describes the test. The second parameter is the result of the test (true for Pass, false for a failure),. An optional third parameter is for additional information. For example:

logTestResult("Text buffer comparison",      TextField_text.equals(msExpect));

Here is another example that uses the third parameter for additional information:

if(TextField_text.equals(msExpect)) 
{
    logTestResult("Text buffer comparison", true);
} 
else 
{
    logTestResult("Text buffer comparison", false,        "Expected '"+TextField_text+"' but found '"+msExpect+"'");
}

If you want to write an error message to the log, use the logError method:

catch (Exception e)
   {logError("Exception e = "+e.toString());}

You can add a warning message to the log using the logWarning method:

logWarning("Your warning message goes here.");

+

Search Tips   |   Advanced Search