Test Automation FX 中的错误报告

Posted

技术标签:

【中文标题】Test Automation FX 中的错误报告【英文标题】:Error reporting in Test 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部分怎么处理?

【问题讨论】:

【参考方案1】:

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

FailTest AreEqual

使用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

【讨论】:

以上是关于Test Automation FX 中的错误报告的主要内容,如果未能解决你的问题,请参考以下文章

Word Automation 中的 SaveAs 给我一个“这不是一个有效的文件名”错误

api_automation_test开源项目部署

python开启httpserver服务在自动化测试中的一个小运用

代码调试包Infragistics Windows Forms Test Automation发布v16.1|附下载

打开sap,然后通过c#Automation继续登录屏幕

登录 Revit Design Automation 加载项