【问题标题】:Error reporting in Test Automation FXTest Automation FX 中的错误报告
【发布时间】:2013-10-24 06:30:07
【问题描述】:
我使用 Test Automation FX 创建自动化测试,我是初学者。
我需要知道如何在测试脚本中失败测试?
我正在使用 C# 脚本。
如果我想识别某个窗口控件并且必须对其执行操作:
if(window["Exists"])
{
//Perform action.
}
else
{
// move to the next test cases.
}
不知道else部分怎么处理?
【问题讨论】:
标签:
c#
error-reporting
testautomationfx
【解决方案1】:
要在窗口不存在时报告测试用例失败,您可以使用Test Automation FX API 中的Verify 类的以下方法:
使用FailTest 方法:
if (window["Exist"])
{
// Perform actions
}
else
{
Verify.FailTest("Window does not exist"); // Report failure message that will be shown in test report
}
使用AreEqual 方法:
Verify.AreEqual(window["Exist"], true); // will fail test if window dows not exist
// Perform actions