以下示例是可用作评估同步点结果的起点的定制代码类。您可以使用此模板编写一个类,用于在图像同步和窗口事件同步对于您的测试不切实际时执行同步。
import com.ibm.rational.test.lt.kernel.services.ITestExecutionServices;
import org.eclipse.hyades.test.common.event.VerdictEvent;
import com.ibm.rational.test.lt.execution.citrix.customcode.CitrixCustomCodeImpl2;
import com.ibm.rational.test.lt.execution.citrix.customcode.ICitrixCustomCode2;
public String exec(ITestExecutionServices tes, String[] args) {
ICitrixCustomCode2 thisCode = new CitrixCustomCodeImpl2(tes);
// to get the last VP status
int verdict = thisCode.getLastVerificationPointVerdict();
if (verdict != VerdictEvent.VERDICT_PASS) {
// this example reports a message but must be adapted to your specific needs
tes.getTestLogManager().reportMessage("last VP status: " + thisCode.verdictEventToString(verdict));
}
return null;
}
以下示例说明如何能够在回放期间记录截屏来用于调试目的。截屏记录在测试日志中,并且可以在“Citrix 图像同步”视图中进行查看。
import com.ibm.rational.test.lt.kernel.services.ITestExecutionServices;
import com.ibm.rational.test.lt.execution.citrix.customcode.*;
public String exec(ITestExecutionServices tes, String[] args) {
ICitrixCustomCode2 thisCode = new CitrixCustomCodeImpl2(tes);
// To capture and log the full screen:
session.putAsset(currentAsset);
// To capture and log a part of the screen:
// thisCode.logPartialScreenCapture(x, y, width, height);
// To capture and log a part of the screen to a file:
// thisCode.savePartialScreenCapture(filename, x, y, width, height);
return null;
}