Troubleshooting- Screenshots on Fail

Learn how to generate screenshots on test's fail.

Example

[TestFixture]
public class AppScreenshotsOnFailTests : DesktopTest
{
    [Test]
    public void MessageChanged_When_ButtonHovered_Wpf()
    {
        var button = App.Components.CreateByName<Button>("E Button");

        button.Hover();

        var label = App.Components.CreateByName<Button>("ebuttonHovered");
        Assert.AreEqual("ebuttonHovered", label.InnerText);
    }
}

Explanations If it is turned on the engine will capture a screenshot in case the test failed.

Configuration

If you open the testFrameworkSettings.json file, you find the screenshotsSettings section that controls this behaviour.

"screenshotsSettings": {
    "isEnabled": "true",
    "filePath": "C:\\Troubleshooting\\Screenshots"
}

You can turn off the making of screenshots for all tests and specify where the screenshots to be saved. In the extensibility chapters read more about how you can create different screenshots engine or change the saving strategy.