Вопрос

I create automated tests with Test Automation FX and I'm beginner.

I need to know how to fail test from within test script?

I am using C# scripting.

Say if I want to recognize some window control and have to perform action on that:

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

I don't know how to handle the else part?

Это было полезно?

Решение

To report failure of test case when window does not exist you can use following methods of of Verify class from Test Automation FX API:

with FailTest method:

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

with AreEqual method:

    Verify.AreEqual(window["Exist"], true); // will fail test if window dows not exist
    // Perform actions
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top