代理代码调试的实现日志

Rational® Functional Tester 提供日志基础结构,调试开发代理代码时,您可以使用此结构。 FTDebug 类可用于 Java 和 .Net 代理开发框架中。 您可以针对每种代理类,将 FTDebug 类的对象进行实例化,并分类记录所有信息、警告或错误消息。

开始之前

此示例代码显示如何在 Java 中实现对代理代码的日志记录:

import com.rational.test.ft.util.FtDebug;
.
public class MyProxy extends BaseProxy
{
	protected static FtDebug debug = new FtDebug("myproxies");
	.
	void anyMethod()
	{
		debug.trace("Beginging of anyMethod()");
		.
		debug.verbose("I'm doing this!");
		.
		debug.warning("Not critical, good to have it fixed");
		.
		debug.error("I shouldn't have been here!!") ;
		.
		debug.trace("End of anyMethod()");
	}
}

此示例代码显示如何在 .Net 中实现对代理代码的日志记录:

.
using Rational.Test.Ft.Util;
.
public class MyProxy : BaseProxy
{
	protected static FtDebug debug = new FtDebug("myproxies");
	.
	void anyMethod()
	{
		debug.Trace("Beginging of anyMethod()");
		.
		debug.Verbose("I'm doing this!");
		.
		debug.Warning("Not critical, good to have it fixed");
		.
		debug.Error("I shouldn't have been here!!") ;
		.
		debug.Trace("End of anyMethod()");
	}
}

在该示例中,创建了 FtDebug() 类的新实例,称为 myproxies。您可以使用“记录和跟踪”页面上的“跟踪组件”设置来控制在执行期间发出的跟踪信息的级别。有关更多信息,请参阅“记录和跟踪”页面


反馈