Functional Tester 支持几种类型的日志文件,或根本无需日志。通过用户界面选择日志文件的类型(HTML 日志或文本日志)。每个记录的事件都有关联的消息。
Functional Tester 会自动记录以下事件:
要使用脚本编制 SDK 在通过用户界面指定的任意类型日志中包含您自己的常规消息,请使用 logInfo 方法,如以下示例所示:
if(AnAWTButtonButton(p1,0)isEnabled())
{
logInfo("AWT button is enabled.");
}
else
{
logInfo("AWT button is not enabled.");
}
通过脚本编制框架,您可以通过使用 logTestResult 方法来记录测试结果。第一个参数是描述测试的说明标题。第二个参数是测试结果(true 是通过,false 是失败)。第三个可选参数是附加信息。例如:
logTestResult("Text buffer comparison",
TextField_text.equals(msExpect));
另一示例使用了第三个参数(附加信息):
if(TextField_text.equals(msExpect))
{
logTestResult("Text buffer comparison", true);
}
else
{
logTestResult("Text buffer comparison", false,
"Expected '"+TextField_text+"' but found '"+msExpect+"'");
}
如果要使用脚本编制框架将错误消息写入日志,请使用 logError 方法:
catch (Exception e)
{logError("Exception e = "+e.toString());}
通过脚本编制 SDK,您可以使用 logWarning 方法将警告消息添加到日志:
logWarning("Your warning message goes here.");