Test Automation FX 中的错误报告

Error reporting in Test Automation FX

提问人:Srinidhi 提问时间:10/16/2013 最后编辑:Andrii KalytiiukSrinidhi 更新时间:10/17/2013 访问量:143

问:

我使用 Test Automation FX 创建自动化测试,我是初学者。

我需要知道如何在测试脚本中使测试失败?

我正在使用 C# 脚本。

假设我想识别某些窗口控件并且必须对其执行操作:

if(window["Exists"])
{
    //Perform action.
}
else
{
    // move to the next test cases.
}

我不知道如何处理其他部分?

C# 错误报告 testautomationfx

评论


答:

0赞 Andrii Kalytiiuk 10/16/2013 #1

若要在窗口不存在时报告测试用例的失败,可以使用 Test Automation FX APIVerify 类的以下方法:

使用方法: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