Writing messages to the log

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

Rational® 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.

Rational® Functional Tester automatically logs the following events:
  • Script start
  • Script end
  • Calls to the CallScript method
  • Calls to the StartApplication method
  • Timer start
  • Timer end
  • Exceptions
  • Verification points

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() Then
      LogInfo("AWT button is enabled.")
   Else
      LogInfo("AWT button is not enabled.")
   End If

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 an other example that uses the third parameter for additional information:


   If TextField_text.Equals(msExpect)) Then
         LogTestResult("Text buffer comparison", true)
   Else
         LogTestResult("Text buffer comparison", false, _
          "Expected ""Hello"", but found ""Good bye!""")
   End If

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


   Catch e As Exception
      LogError("Exception e = " + e.ToString())

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


   LogWarning("Your warning message goes here.")