This is a migrated thread and some comments may be shown as answers.

Pause UI Test on failure

3 Answers 94 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
R Stewart
Top achievements
Rank 1
R Stewart asked on 01 Jun 2010, 05:45 PM
Apart from logging failures during the testing process is there a way to have the computer stop executing the test and beep so that I could look in real time for more information on the error?

For example Navigate to a page and if a Verify 'Inner Text' Exact 'something in here' doesn't show after 30 seconds I would be notified?

Thanks,

Ray

3 Answers, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 01 Jun 2010, 09:31 PM
Hi R Stewart,

There isn't a built-in feature like that. I've logged a feature request on this. You could implement it yourself in a code-behind method though. Do you need an example showing how to do this?

Greetings,
Cody
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
R Stewart
Top achievements
Rank 1
answered on 01 Jun 2010, 10:09 PM
I'd love a code example where the testing would be paused and perhaps a beep or sound with a popup on the screen.

Thanks,

Ray
0
Cody
Telerik team
answered on 01 Jun 2010, 11:12 PM
Hi R Stewart,

Certainly! Convert your verification step to code and then just use standard .NET programming to catch the exception and do anything you want with the catch block. For example:

[CodedStep(@"Verify 'TextContent' 'Contains' 'Africa' on 'AfricaStrongTag'")]
public void BingTest_CodedStep()
{
    string Expected = "Unexpected Africa";
    try
    {
        // Verify 'TextContent' 'Contains' 'Africa' on 'AfricaStrongTag'
        Pages.AfricaBing_0.AfricaStrongTag.AssertContent().TextContent(ArtOfTest.Common.StringCompareType.Contains, Expected);
    }
    catch (Exception)
    {
        Console.Beep();
        System.Windows.Forms.MessageBox.Show(String.Format("Error occurred in verification. Expected:\"{0}\" Actual:\"{1}\". Pausing test.",
            Expected, Pages.AfricaBing_0.AfricaStrongTag.BaseElement.TextContent));
        throw;
    }
}

Be sure to re-throw the exception at the end of your catch block so that the framework will see it and catch it as well. Else the framework won't know an error occurred and will blindly move on to the next step thinking everything is fine.

Greetings,
Cody
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
General Discussions
Asked by
R Stewart
Top achievements
Rank 1
Answers by
Cody
Telerik team
R Stewart
Top achievements
Rank 1
Share this question
or