문제

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