Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/267.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 测试自动化FX中的错误报告_C#_Error Reporting_Testautomationfx - Fatal编程技术网

C# 测试自动化FX中的错误报告

C# 测试自动化FX中的错误报告,c#,error-reporting,testautomationfx,C#,Error Reporting,Testautomationfx,我用创建自动化测试,我是初学者 我需要知道如何从测试脚本中测试失败 我正在使用C#脚本 假设我想识别某个窗口控件并对其执行操作: if(window["Exists"]) { //Perform action. } else { // move to the next test cases. } 我不知道如何处理else部分?要在窗口不存在时报告测试用例失败,您可以使用以下类的方法: 使用故障测试方法: if (window["Exist"]) {

我用创建自动化测试,我是初学者

我需要知道如何从测试脚本中测试失败

我正在使用C#脚本

假设我想识别某个窗口控件并对其执行操作:

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

我不知道如何处理else部分?

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

使用
故障测试
方法:

    if (window["Exist"])
    {
        // Perform actions
    }
    else
    {
        Verify.FailTest("Window does not exist"); // Report failure message that will be shown in test report
    }
    Verify.AreEqual(window["Exist"], true); // will fail test if window dows not exist
    // Perform actions
使用
AreEqual
方法:

    if (window["Exist"])
    {
        // Perform actions
    }
    else
    {
        Verify.FailTest("Window does not exist"); // Report failure message that will be shown in test report
    }
    Verify.AreEqual(window["Exist"], true); // will fail test if window dows not exist
    // Perform actions